File contents
Index: lib/Components/BTree/BTree.c
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/Components/BTree/BTree.c,v
retrieving revision 1.2
diff -c -4 -r1.2 BTree.c
*** lib/Components/BTree/BTree.c 9 Jan 2002 14:25:28 -0000 1.2
--- lib/Components/BTree/BTree.c 25 Jan 2002 15:04:34 -0000
***************
*** 1176,1184 ****
DECREF_VALUE(self->data[i].value);
}
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) PyDict_Clear(dict);
self->len=0;
! self->state=cPersistent_GHOST_STATE;
}
Py_INCREF(Py_None);
return Py_None;
--- 1176,1184 ----
DECREF_VALUE(self->data[i].value);
}
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) PyDict_Clear(dict);
self->len=0;
! PER_GHOSTIFY(self);
}
Py_INCREF(Py_None);
return Py_None;
***************
*** 1234,1242 ****
PyObject *dict;
if(_BTree_clear(self) < 0) return NULL;
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) PyDict_Clear(dict);
! self->state=cPersistent_GHOST_STATE;
}
Py_INCREF(Py_None);
return Py_None;
--- 1234,1242 ----
PyObject *dict;
if(_BTree_clear(self) < 0) return NULL;
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) PyDict_Clear(dict);
! PER_GHOSTIFY(self);
}
Py_INCREF(Py_None);
return Py_None;
Index: lib/Components/BTree/intSet.c
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/Components/BTree/intSet.c,v
retrieving revision 1.2
diff -c -4 -r1.2 intSet.c
*** lib/Components/BTree/intSet.c 9 Jan 2002 14:25:29 -0000 1.2
--- lib/Components/BTree/intSet.c 25 Jan 2002 15:04:34 -0000
***************
*** 439,447 ****
if(self->state==cPersistent_UPTODATE_STATE
&& HasInstDict(self) && (dict=INSTANCE_DICT(self)))
{
PyDict_Clear(dict);
! self->state=cPersistent_GHOST_STATE;
}
Py_INCREF(Py_None);
return Py_None;
--- 439,447 ----
if(self->state==cPersistent_UPTODATE_STATE
&& HasInstDict(self) && (dict=INSTANCE_DICT(self)))
{
PyDict_Clear(dict);
! PER_GHOSTIFY(self);
}
Py_INCREF(Py_None);
return Py_None;
Index: lib/Components/ExtensionClass/src/Record.c
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/Components/ExtensionClass/src/Record.c,v
retrieving revision 1.2
diff -c -4 -r1.2 Record.c
*** lib/Components/ExtensionClass/src/Record.c 9 Jan 2002 14:25:29 -0000 1.2
--- lib/Components/ExtensionClass/src/Record.c 25 Jan 2002 15:04:34 -0000
***************
*** 220,228 ****
{
Record_deal(self);
self->schema=NULL;
self->data=NULL;
! self->state=cPersistent_GHOST_STATE;
Py_INCREF(Py_None);
return Py_None;
}
#endif
--- 220,228 ----
{
Record_deal(self);
self->schema=NULL;
self->data=NULL;
! PER_GHOSTIFY(self);
Py_INCREF(Py_None);
return Py_None;
}
#endif
Index: lib/python/BTrees/BTreeTemplate.c
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/python/BTrees/BTreeTemplate.c,v
retrieving revision 1.1.1.2
diff -c -4 -r1.1.1.2 BTreeTemplate.c
*** lib/python/BTrees/BTreeTemplate.c 10 Sep 2001 14:55:08 -0000 1.1.1.2
--- lib/python/BTrees/BTreeTemplate.c 25 Jan 2002 15:04:34 -0000
***************
*** 643,651 ****
{
if (self->state==cPersistent_UPTODATE_STATE && self->jar)
{
if (_BTree_clear(self) < 0) return NULL;
! self->state=cPersistent_GHOST_STATE;
}
Py_INCREF(Py_None);
return Py_None;
--- 643,651 ----
{
if (self->state==cPersistent_UPTODATE_STATE && self->jar)
{
if (_BTree_clear(self) < 0) return NULL;
! PER_GHOSTIFY(self);
}
Py_INCREF(Py_None);
return Py_None;
Index: lib/python/BTrees/BucketTemplate.c
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/python/BTrees/BucketTemplate.c,v
retrieving revision 1.1.1.2
diff -c -4 -r1.1.1.2 BucketTemplate.c
*** lib/python/BTrees/BucketTemplate.c 10 Sep 2001 14:55:08 -0000 1.1.1.2
--- lib/python/BTrees/BucketTemplate.c 25 Jan 2002 15:04:34 -0000
***************
*** 859,867 ****
{
if (self->state==cPersistent_UPTODATE_STATE && self->jar)
{
if (_bucket_clear(self) < 0) return NULL;
! self->state=cPersistent_GHOST_STATE;
}
Py_INCREF(Py_None);
return Py_None;
--- 859,867 ----
{
if (self->state==cPersistent_UPTODATE_STATE && self->jar)
{
if (_bucket_clear(self) < 0) return NULL;
! PER_GHOSTIFY(self);
}
Py_INCREF(Py_None);
return Py_None;
Index: lib/python/ZODB/Connection.py
===================================================================
RCS file: /home/cvs/development/external/Zope2/lib/python/ZODB/Connection.py,v
retrieving revision 1.7
diff -c -4 -r1.7 Connection.py
*** lib/python/ZODB/Connection.py 10 Sep 2001 15:32:28 -0000 1.7
--- lib/python/ZODB/Connection.py 25 Jan 2002 15:04:35 -0000
***************
*** 91,99 ****
from POSException import ConflictError, ExportError
from cStringIO import StringIO
from cPickle import Unpickler, Pickler
from ExtensionClass import Base
! from time import time
import Transaction, string, ExportImport, sys, traceback, TmpStore
from zLOG import LOG, ERROR, BLATHER
from coptimizations import new_persistent_id
from ConflictResolution import ResolvedSerial
--- 91,99 ----
from POSException import ConflictError, ExportError
from cStringIO import StringIO
from cPickle import Unpickler, Pickler
from ExtensionClass import Base
! from time import time,clock
import Transaction, string, ExportImport, sys, traceback, TmpStore
from zLOG import LOG, ERROR, BLATHER
from coptimizations import new_persistent_id
from ConflictResolution import ResolvedSerial
***************
*** 136,149 ****
cache_deactivate_after=60):
"""Create a new Connection"""
self._version=version
self._cache=cache=PickleCache(self, cache_size, cache_deactivate_after)
! self._incrgc=self.cacheGC=cache.incrgc
self._invalidated=d={}
self._invalid=d.has_key
self._committed=[]
self._code_timestamp = global_code_timestamp
def __repr__(self):
if self._version:
ver = ' (in version %s)' % `self._version`
else:
--- 136,164 ----
cache_deactivate_after=60):
"""Create a new Connection"""
self._version=version
self._cache=cache=PickleCache(self, cache_size, cache_deactivate_after)
! if version:
! # Caches for versions end up empty if the version
! # is not used for a while. Non-version caches
! # keep their content indefinitely.
! self._cache.cache_drain_resistance = 100
! self.cacheGC=cache.incrgc
self._invalidated=d={}
self._invalid=d.has_key
self._committed=[]
self._code_timestamp = global_code_timestamp
+ def _incrgc(self):
+ a = len(self._cache.cache_data)
+ x = self._cache.cache_non_ghost_count
+ start = time()#clock()
+ self._cache.incrgc()
+ end = time()#clock()
+ b = len(self._cache.cache_data)
+ y = self._cache.cache_non_ghost_count
+ print '%4d->%4d %4d->%4d %.1f ms' % (a,b,x,y,(end-start)*1000)
+
def __repr__(self):
if self._version:
ver = ' (in version %s)' % `self._version`
else:
***************
*** 224,232 ****
object=klass.__basicnew__()
object._p_oid=oid
object._p_jar=self
object._p_changed=None
!
cache[oid]=object
return object
--- 239,247 ----
object=klass.__basicnew__()
object._p_oid=oid
object._p_jar=self
object._p_changed=None
!
cache[oid]=object
return object