[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/src collectiondata.c connection.c dat...
From: |
Treshna Enterprises |
Subject: |
gnue/geas/src collectiondata.c connection.c dat... |
Date: |
Mon, 25 Jun 2001 20:01:26 -0700 |
CVSROOT: /cvs
Module name: gnue
Changes by: Treshna Enterprises <address@hidden> 01/06/25 20:01:26
Modified files:
geas/src : collectiondata.c connection.c dataobject.c
geas-server.c geas-server.h geas-skeleton.c
objectlist.c
geas/src/objectcache: objectcache.c objectcache.h
geas/src/objectstore: postgresql.c
Log message:
mostly hacks that are attempting to make things faster/more stable. no
guarantees of success, though
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/collectiondata.c.diff?cvsroot=OldCVS&tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/connection.c.diff?cvsroot=OldCVS&tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/dataobject.c.diff?cvsroot=OldCVS&tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-server.c.diff?cvsroot=OldCVS&tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-server.h.diff?cvsroot=OldCVS&tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-skeleton.c.diff?cvsroot=OldCVS&tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectlist.c.diff?cvsroot=OldCVS&tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache.c.diff?cvsroot=OldCVS&tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache.h.diff?cvsroot=OldCVS&tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/postgresql.c.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnue/geas/src/collectiondata.c
diff -u gnue/geas/src/collectiondata.c:1.27 gnue/geas/src/collectiondata.c:1.28
--- gnue/geas/src/collectiondata.c:1.27 Wed Jun 13 06:28:56 2001
+++ gnue/geas/src/collectiondata.c Mon Jun 25 20:01:25 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: collectiondata.c,v 1.27 2001/06/13 13:28:56 baumannd Exp $
+ $Id: collectiondata.c,v 1.28 2001/06/26 03:01:25 treshna Exp $
*/
@@ -142,8 +142,11 @@
timer_fail_operation( TIMER_LISTS );
return (NULL);
}
+// hack_id = g_new0( GEAS_object_reference , 1 );
+// Connection_realNewObject( hack_id );
+// free_geas_object_reference( hack_id );
+// hack_id = NULL;
-
GEAS_DataObject_setField (lst, "length", "0", ev);
GEAS_DataObject_setField (lst, "classname", classname, ev); /* what
object, class */
@@ -164,6 +167,8 @@
debug_output (DEBUGLEVEL_3, "List length: %d", len);
if( len > 0 ) {
+ GEAS_DataObject hackobj; /* a grep for the word 'hack' will be far too
scary */
+
ObjectKey keydata;
int fieldid = oql_query_get_field_position(query,"objectid");
GList *row = result->data;
@@ -177,6 +182,8 @@
keydata = create_new_object_key ();
/* printf( "geas::listitem/%s\n" , object_key_as_string(keydata) );
*/
ob = oc_add_empty_object ("geas::listitem", object_key_as_string
(keydata));
+ oc_set_object_flag (ob, of_indatabase, FLAG_ON);
+
hacklist = g_list_prepend( hacklist , ob );
g_free (keydata);
sprintf (buf, "%d", i);
@@ -194,6 +201,14 @@
/* printf( "key = '%s'\n" , key ); */
ob = oc_add_empty_object( classname , key );
+ oc_set_object_flag (ob, of_indatabase, FLAG_ON);
+
+ /* make reference and store in object as userdata */
+ if( oc_get_object_userdata(ob) == NULL ) {
+ hackobj = make_dataobject_reference( classname , key ,
xid->username , xid->sessionid , ev );
+ oc_set_object_userdata( ob , (void *)hackobj );
+ }
+
for( fieldid=0 ; fieldid<result->field_count ; fieldid++ ) {
if( fieldid != oididx ) {
/* printf( "'%s' = '%s'\n" , get_result_field_name(result,fieldid)
, get_field_in_row(row->data,fieldid) ); */
@@ -207,7 +222,11 @@
}
}
oc_set_object_userdata( hackobj , hacklist );
-
+ if(0) {
+ char buf[64];
+ printf( "press enter\n" );
+ gets(buf);
+ }
lenstr = g_strdup_printf ("%lu", len);
GEAS_DataObject_setField (lst, "length", lenstr, ev);
g_free (lenstr);
@@ -220,6 +239,9 @@
// timer_update_profile( TIMER_FUNC_MAKELIST );
timer_done_operation( TIMER_LISTS );
+ printf( "cache stats after list creation: " );
+ oc_print_stats();
+ printf( "\n" );
return (listid);
}
Index: gnue/geas/src/connection.c
diff -u gnue/geas/src/connection.c:1.62 gnue/geas/src/connection.c:1.63
--- gnue/geas/src/connection.c:1.62 Tue Jun 12 12:12:30 2001
+++ gnue/geas/src/connection.c Mon Jun 25 20:01:26 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: connection.c,v 1.62 2001/06/12 19:12:30 reinhard Exp $
+ $Id: connection.c,v 1.63 2001/06/26 03:01:26 treshna Exp $
*/
@@ -306,6 +306,7 @@
/* requested class to cache */
ob = oc_add_empty_object (odl_class_get_full_name (cl), id->objectid);
+ oc_set_object_flag (ob, of_indatabase, FLAG_ON);
fields = odl_class_get_fields (cl, FT_basic);
fl = fields;
while (fl)
@@ -334,6 +335,7 @@
}
ob = oc_add_empty_object (l->data, id->objectid);
+ oc_set_object_flag (ob, of_indatabase, FLAG_ON);
fields = odl_class_get_fields (c, FT_basic);
fl = fields;
while (fl)
Index: gnue/geas/src/dataobject.c
diff -u gnue/geas/src/dataobject.c:1.56 gnue/geas/src/dataobject.c:1.57
--- gnue/geas/src/dataobject.c:1.56 Tue Jun 19 13:38:09 2001
+++ gnue/geas/src/dataobject.c Mon Jun 25 20:01:26 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: dataobject.c,v 1.56 2001/06/19 20:38:09 reinhard Exp $
+ $Id: dataobject.c,v 1.57 2001/06/26 03:01:26 treshna Exp $
*/
@@ -174,6 +174,7 @@
}
/* raises: UnknownField, NotReadable, Interrupted, NullField, ServerError,
NotDataField, Locked, TransactionNotInProgress */
+extern int sillytest;
CORBA_char *
DataObject_getField (GEAS_object_reference * id, CORBA_char * fieldname,
CORBA_Environment * ev)
@@ -243,13 +244,21 @@
/* find object in cache, and get field */
/* printf( "looking for %s/%s\n" , odl_class_get_full_name(cl), id->objectid
); */
/* don't log GEAS classes */
+
+
if (allow_log_class_event (odl_class_get_full_name (cl)))
dm_event (id->username, id->currenttransaction, DM_EVENT_FIELD_READ,
odl_class_get_full_name (cl), id->objectid, fieldname);
+
+//if( sillytest == 1 )
+// return CORBA_string_dup( "hey" );
+
obj = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
if (obj)
{
+//if( sillytest == 0 )
retval = (char *) oc_get_object_field (obj, fieldname);
+//else retval = CORBA_string_dup( "hello" );
if (retval)
{
char *t = CORBA_string_dup (retval);
@@ -264,6 +273,7 @@
}
else
{
+ return CORBA_string_dup( "hey" );
/* this should, in theory, be impossible */
make_ServerError_exception (ev,
"1 Impossible error: object went missing.
(%s/%s)",
@@ -380,7 +390,7 @@
break;
case DT_boolean:
case DT_bool:
- /* andrew murie: I'ld like to take this opportunity to say that
+ /* I'ld like to take this opportunity to say that
defining a boolean like this just really isn't bright
and it wasn't my decision.
Index: gnue/geas/src/geas-server.c
diff -u gnue/geas/src/geas-server.c:1.105 gnue/geas/src/geas-server.c:1.106
--- gnue/geas/src/geas-server.c:1.105 Wed Jun 20 15:26:23 2001
+++ gnue/geas/src/geas-server.c Mon Jun 25 20:01:26 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: geas-server.c,v 1.105 2001/06/20 22:26:23 reinhard Exp $
+ $Id: geas-server.c,v 1.106 2001/06/26 03:01:26 treshna Exp $
*/
@@ -180,7 +180,7 @@
unsigned int unaccounted;
printf( "\n----------------------------------\n"
- "Profiles: (time in seconds to 4dp)\n" );
+ "Profiles: (time in seconds to 6dp)\n" );
unaccounted = timer_profiles[ TIMER_FUNC_OPERATION ].total;
@@ -189,6 +189,9 @@
printf( "PROFILE: " );
switch( i )
{
+ case TIMER_FUNC_MAKEREF : printf( "make ref() : " ); break;
+ case TIMER_FUNC_MAKEOID : printf( "make oid() : " ); break;
+ case TIMER_FUNC_HANDLERESULTS: printf( "handle results : " ); break;
case TIMER_FUNC_GETFIELD : printf( "getField() : " ); break;
case TIMER_FUNC_SETFIELD : printf( "setField() : " ); break;
case TIMER_FUNC_NEWOBJECT : printf( "newObject() : " ); break;
@@ -201,10 +204,26 @@
case TIMER_FUNC_GET_FIELD : printf( "get field : " ); break;
case TIMER_FUNC_SET_FIELD : printf( "set field : " ); break;
case TIMER_FUNC_FLUSH : printf( "flush : " ); break;
-// case TIMER_FUNC_MAKELIST : printf( "make list : " ); break;
+ case TIMER_FUNC_TEMP1 : printf( "filling object array: " ); break;
+ case TIMER_FUNC_GETENTRY : printf( "getEntry() : " ); break;
+ case TIMER_FUNC_LOOKUP : printf( "hash table lookup : " ); break;
+ case TIMER_FUNC_EXECQUERY : printf( "exec query : " ); break;
case TIMER_FUNC_RELEASELIST: printf( "release list : " ); break;
+
+ case TIMER_FUNC_A : printf( "temp A : " ); break;
+ case TIMER_FUNC_B : printf( "temp B : " ); break;
+ case TIMER_FUNC_C : printf( "temp C : " ); break;
+ case TIMER_FUNC_D : printf( "temp D : " ); break;
+ case TIMER_FUNC_E : printf( "temp E : " ); break;
+ case TIMER_FUNC_F : printf( "temp F : " ); break;
+ case TIMER_FUNC_G : printf( "temp G : " ); break;
+ case TIMER_FUNC_H : printf( "temp H : " ); break;
+ case TIMER_FUNC_I : printf( "temp I : " ); break;
+ case TIMER_FUNC_J : printf( "temp J : " ); break;
+ case TIMER_FUNC_K : printf( "temp K : " ); break;
+ case TIMER_FUNC_L : printf( "temp L : " ); break;
}
- printf( "count:%5lu min:%7.4f avg:%7.4f max:%7.4f tot:%7.4f\n" ,
+ printf( "count:%5lu min:%9.6f avg:%9.6f max:%9.6f tot:%9.6f\n" ,
timer_profiles[i].count,
us_to_seconds( timer_profiles[i].min ),
us_to_seconds( timer_profiles[i].avg ),
@@ -212,8 +231,10 @@
us_to_seconds( timer_profiles[i].total ) );
if( i != TIMER_FUNC_OPERATION ) unaccounted -= timer_profiles[i].total;
}
+ timer_profiles[i].count = 0;
}
- printf( "Time not accounted for: %.4f\n" , us_to_seconds(unaccounted) );
+ refill_oid_buffer (1024 * 1024);
+ oc_print_stats();
}
void timer_start_profile( int function )
@@ -292,7 +313,7 @@
{
int i;
va_list ap;
-
+return;
/* increment stack poitner */
timer_operation_count++;
@@ -318,6 +339,7 @@
{
unsigned long int diff;
int i;
+return;
g_assert( timer_operation_count >= 0 );
if( active_timer_sections[section] == 1 ) {
@@ -336,6 +358,7 @@
{
unsigned long int diff;
int i;
+return;
g_assert( timer_operation_count >= 0 );
if( active_timer_sections[section] == 1 ) {
@@ -366,7 +389,6 @@
char *filename = NULL;
FILE *fp = NULL;
#ifdef TIMER_TESTING
- struct itimerval timerdata;
struct timeval tv;
int i;
#endif
Index: gnue/geas/src/geas-server.h
diff -u gnue/geas/src/geas-server.h:1.50 gnue/geas/src/geas-server.h:1.51
--- gnue/geas/src/geas-server.h:1.50 Tue Jun 12 21:28:21 2001
+++ gnue/geas/src/geas-server.h Mon Jun 25 20:01:26 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: geas-server.h,v 1.50 2001/06/13 04:28:21 treshna Exp $
+ $Id: geas-server.h,v 1.51 2001/06/26 03:01:26 treshna Exp $
*/
/** \file geas-server.h
@@ -56,9 +56,28 @@
#define TIMER_FUNC_MAKELIST 11
#define TIMER_FUNC_RELEASELIST 12
#define TIMER_FUNC_MAKEID 13
-
- #define TIMER_FUNC_OPERATION 49
-
+ #define TIMER_FUNC_EXECQUERY 14
+ #define TIMER_FUNC_HANDLERESULTS 15
+ #define TIMER_FUNC_LOOKUP 16
+ #define TIMER_FUNC_TEMP1 17
+ #define TIMER_FUNC_GETENTRY 18
+
+ #define TIMER_FUNC_A 42
+ #define TIMER_FUNC_B 43
+ #define TIMER_FUNC_C 44
+ #define TIMER_FUNC_D 45
+ #define TIMER_FUNC_E 46
+ #define TIMER_FUNC_F 47
+ #define TIMER_FUNC_G 48
+ #define TIMER_FUNC_H 49
+ #define TIMER_FUNC_I 50
+ #define TIMER_FUNC_J 51
+ #define TIMER_FUNC_K 52
+ #define TIMER_FUNC_L 53
+
+ #define TIMER_FUNC_MAKEOID 97
+ #define TIMER_FUNC_MAKEREF 98
+ #define TIMER_FUNC_OPERATION 99
#define TIMER_FUNC_COUNT 100
Index: gnue/geas/src/geas-skeleton.c
diff -u gnue/geas/src/geas-skeleton.c:1.66 gnue/geas/src/geas-skeleton.c:1.67
--- gnue/geas/src/geas-skeleton.c:1.66 Tue Jun 12 21:28:21 2001
+++ gnue/geas/src/geas-skeleton.c Mon Jun 25 20:01:26 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: geas-skeleton.c,v 1.66 2001/06/13 04:28:21 treshna Exp $
+ $Id: geas-skeleton.c,v 1.67 2001/06/26 03:01:26 treshna Exp $
*/
@@ -159,10 +159,12 @@
}
/* if a real user, look for transaction ID */
+#if 0
if (strcmp (retval->username, SERVER_PRIVATE_USERNAME) != 0)
{
get_users_current_transaction_status (retval);
}
+#endif
}
/* Free extra memory */
@@ -955,7 +957,6 @@
trace_functioncall ();
if (allow_oid_refill)
refill_oid_buffer (5);
-
id = get_current_object_reference (servant, servant->poa, ev);
if (ev->_major != CORBA_NO_EXCEPTION) {
timer_fail_operation( TIMER_SKELETON );
@@ -965,12 +966,21 @@
ob = oc_find_object_by_key (id->classname, id->objectid);
if (ob)
{
+
if (oc_get_object_flag (ob, of_indatabase) == FLAG_ON)
retval = CORBA_TRUE;
}
- free_geas_object_reference (id);
timer_done_operation( TIMER_SKELETON );
+#ifdef STUPID_CRAP
+printf( "in database :- %s/%s : %d (T:%d F:%d)\n" , id->classname,
id->objectid , retval , CORBA_TRUE,CORBA_FALSE );
+ {
+ char xyz[64];
+ printf( "press enter\n" );
+ gets(xyz);
+ }
+#endif
+ free_geas_object_reference (id);
return retval;
}
@@ -1051,6 +1061,8 @@
return retval;
}
+int sillytest = 0;
+
static GEAS_ObjectList
impl_GEAS_Connection_loadAll (impl_POA_GEAS_Connection * servant,
CORBA_char * classname, CORBA_Environment * ev)
@@ -1068,6 +1080,7 @@
}
if( strcmp(classname,"start") == 0 )
{
+ sillytest = 1;
timer_start_profile(TIMER_FUNC_OPERATION);
make_ServerError_exception(ev,"not really an error");
return retval;
@@ -1719,9 +1732,10 @@
trace_functioncall ();
- if (allow_oid_refill)
- refill_oid_buffer (5);
+// if (allow_oid_refill)
+// refill_oid_buffer (5);
+//if( sillytest == 0 )
id = get_current_object_reference (servant, servant->poa, ev);
timer_start_operation(TIMER_SKELETON,"%s.getField(%s)",id->classname,fieldname);
@@ -1732,8 +1746,12 @@
return (retval);
}
- retval = DataObject_getField (id, fieldname, ev);
+//if( sillytest == 0 )
+ retval = DataObject_getField (id, fieldname, ev);
+//else
+// retval = CORBA_string_dup("hello there");
+//if( sillytest == 0 )
free_geas_object_reference (id);
timer_update_profile( TIMER_FUNC_GETFIELD );
timer_done_operation( TIMER_SKELETON );
@@ -2018,6 +2036,7 @@
GEAS_object_reference *id;
timer_start_operation(TIMER_SKELETON,__PRETTY_FUNCTION__);
+ timer_start_profile(TIMER_FUNC_GETENTRY);
trace_functioncall ();
if (allow_oid_refill)
@@ -2026,6 +2045,7 @@
id = get_current_object_reference (servant, servant->poa, ev);
if (ev->_major != CORBA_NO_EXCEPTION) {
timer_fail_operation( TIMER_SKELETON );
+ timer_update_profile(TIMER_FUNC_GETENTRY);
return (retval);
}
@@ -2033,6 +2053,7 @@
free_geas_object_reference (id);
timer_done_operation( TIMER_SKELETON );
+ timer_update_profile(TIMER_FUNC_GETENTRY);
return retval;
}
@@ -2838,10 +2859,12 @@
GEAS_Connection retval = CORBA_OBJECT_NIL;
PortableServer_ObjectId *object_id;
+timer_start_profile( TIMER_FUNC_MAKEOID );
/* create ID */
object_id = PortableServer_string_to_ObjectId ((CORBA_char *) string, ev);
if (ev->_major != CORBA_NO_EXCEPTION)
{
+timer_update_profile( TIMER_FUNC_MAKEOID );
return (CORBA_OBJECT_NIL);
}
@@ -2852,10 +2875,13 @@
(CORBA_char *)
corba_classname, ev);
CORBA_free (object_id);
- if (ev->_major != CORBA_NO_EXCEPTION)
+ if (ev->_major != CORBA_NO_EXCEPTION) {
+ timer_update_profile( TIMER_FUNC_MAKEOID );
return (CORBA_OBJECT_NIL);
+ }
/* done */
+ timer_update_profile( TIMER_FUNC_MAKEOID );
return (retval);
}
@@ -3048,11 +3074,11 @@
while (count < max && oid_count < (OID_BUF_LEN - 1))
{
- timer_start_profile( TIMER_FUNC_MAKEID );
+// timer_start_profile( TIMER_FUNC_MAKEID );
oid_count++;
count++;
uuid_generate (&oid_buffer[oid_count][0]);
- timer_update_profile( TIMER_FUNC_MAKEID );
+// timer_update_profile( TIMER_FUNC_MAKEID );
}
debug_output (DEBUGLEVEL_2, "Created %d oids", count);
}
Index: gnue/geas/src/objectcache/objectcache.c
diff -u gnue/geas/src/objectcache/objectcache.c:1.55
gnue/geas/src/objectcache/objectcache.c:1.56
--- gnue/geas/src/objectcache/objectcache.c:1.55 Wed Jun 13 06:11:41 2001
+++ gnue/geas/src/objectcache/objectcache.c Mon Jun 25 20:01:26 2001
@@ -19,19 +19,19 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: objectcache.c,v 1.55 2001/06/13 13:11:41 baumannd Exp $
+ $Id: objectcache.c,v 1.56 2001/06/26 03:01:26 treshna Exp $
*/
#include "config.h"
#include <glib.h>
+#include <string.h>
#include "geas-server.h"
#include "objectcache.h"
#include "objectstore/objectstore.h"
#include "config/configuration.h"
#include "oql/oql.h"
-#include "geas-skeleton.h"
/* ie, turn off temp. debug output */
#define OC_TEMP_DEBUG (-83) /* DEBUGLEVEL_OFF */
@@ -57,6 +57,13 @@
static guint32 cache_max_size = 0;
static GList *flushable = NULL;
+void
+oc_print_stats( void )
+{
+ printf( "Object Cache: %d entries %d flushable\n" , objectcache_count ,
+ g_list_length(flushable) );
+}
+
static void oc_squeeze_cache (unsigned int spaces_to_make);
static void oc_free_object_data (_ObjectData * o);
static _ObjectData *oc_allocate_object_data (const char *classname,
@@ -77,16 +84,36 @@
void _fill_values (gchar * key, _FieldData * field, GHashTable * values);
+/* ------------------------------------------------------------------------- *\
+ * prepare cache for lots of changes
+\* ------------------------------------------------------------------------- */
+void oc_freeze()
+{
+}
+
+/* ------------------------------------------------------------------------- *\
+ * finish making large numbers of changes
+\* ------------------------------------------------------------------------- */
+void oc_thaw()
+{
+}
+
+
+/* ------------------------------------------------------------------------- *\
+ * set user data in object
+\* ------------------------------------------------------------------------- */
void
oc_set_object_userdata( ObjectData *object , void *data )
{
((_ObjectData *)object)->userdata = data;
}
+/* ------------------------------------------------------------------------- *\
+ * get user data from object
+\* ------------------------------------------------------------------------- */
void *
oc_get_object_userdata( ObjectData *object )
{
-
return ((_ObjectData *)object)->userdata;
}
@@ -110,12 +137,22 @@
timer_start_operation( TIMER_CACHE , __PRETTY_FUNCTION__ );
trace_functioncall ();
+ /* allow infinite numbers of objects anyway */
+ if( cache_max_size == 0 ) return;
+
/* this can't extend it */
if (new_max_length >= cache_max_size) {
timer_fail_operation( TIMER_CACHE);
return;
}
+ if( new_max_length == 0 )
+ {
+ /* make an infinte size cache */
+ cache_max_size = 0;
+ return;
+ }
+
if (new_max_length < 0)
cache_max_size += new_max_length; /* shrink by -N spaces */
else
@@ -143,6 +180,9 @@
timer_start_operation( TIMER_CACHE , __PRETTY_FUNCTION__ );
trace_functioncall ();
+ /* allow infinite numbers of objects anyway */
+ if( cache_max_size == 0 ) return;
+
/* this can't shrink it */
if (new_max_length <= cache_max_size)
return;
@@ -170,6 +210,9 @@
GList *last;
gboolean squeezed = FALSE;
+ /* allow infinite numbers of objects anyway */
+ if( cache_max_size == 0 ) return;
+
timer_start_operation( TIMER_CACHE , __PRETTY_FUNCTION__ );
trace_functioncall ();
@@ -266,7 +309,6 @@
ObjectData *obj;
QueryData *q;
-
trace_functioncall ();
obj = oc_find_cached_object_by_key (classname, key);
if (obj)
@@ -295,7 +337,7 @@
oc_find_cached_object_by_key (const char *classname, const char *key)
{
ObjectData *obj;
- char *lookup;
+ char lookup[1024];
char *p;
timer_start_operation( TIMER_CACHE , __PRETTY_FUNCTION__ );
@@ -311,9 +353,16 @@
}
/* find the classname's hash table - if none object can't be in the */
/* cache yet */
- lookup = g_strdup_printf ("%s-%s", p, key);
+// lookup = g_strdup_printf ("%s-%s", p, key);
+timer_start_profile( TIMER_FUNC_LOOKUP );
+ sprintf( lookup , "%s-%s" , p , key );
obj = g_hash_table_lookup (cachedata, lookup);
- g_free (lookup);
+timer_update_profile( TIMER_FUNC_LOOKUP );
+//if( !obj ) {
+// printf( "not found: '%s'\n" , lookup );
+// abort();
+//}
+// g_free (lookup);
timer_update_profile( TIMER_FUNC_FIND_CACHED_BY_KEY );
timer_done_operation( TIMER_CACHE );
return (obj);
@@ -767,8 +816,9 @@
const char *value, gboolean readonly)
{
_FieldData *f;
- /* GList *idxs, *l, *ids; */
- /* odl_class *c; */
+ _ObjectData *o = object;
+
+/* printf( "setfield: %s/%s.%s = %s\n" , o->classname,o->key , fieldname ,
value ); */
timer_start_profile( TIMER_FUNC_SET_FIELD );
@@ -900,7 +950,6 @@
while (l)
{
/* TODO: verify that all NOT NULL fields in the index have data
*/
- /* char buf[256]; */
oc_add_object_to_index (object, l->data);
l = g_list_next (l);
}
@@ -1001,6 +1050,7 @@
}
/* new objects aren't in any indexes */
o->indexes = NULL;
+ o->userdata = NULL;
}
return (o);
}
@@ -1327,19 +1377,22 @@
trace_functioncall ();
// return( NULL ); /* XYZ */
-
+ timer_start_profile( TIMER_FUNC_E );
if (!q)
{
+ timer_update_profile( TIMER_FUNC_E );
return (NULL);
}
/* name of class to search for */
if (!q->classes)
{
+ timer_update_profile( TIMER_FUNC_E );
return (NULL);
}
classname = q->classes->data;
if (!classname)
{
+ timer_update_profile( TIMER_FUNC_E );
return (NULL);
}
if (debuglevel == OC_TEMP_DEBUG)
@@ -1355,7 +1408,9 @@
printf ("OCCACHE: use objectID to search main cache\n");
}
}
+ timer_update_profile( TIMER_FUNC_E );
+ timer_start_profile( TIMER_FUNC_F );
/* fields to match */
buf = g_string_new (classname);
g_string_append (buf, "/");
@@ -1383,6 +1438,10 @@
{
printf ("OCCACHE: Look in cache '%s'\n", buf->str);
}
+ timer_update_profile( TIMER_FUNC_F );
+
+
+ timer_start_profile( TIMER_FUNC_G );
idx = g_hash_table_lookup (indexes, buf->str);
if (!idx)
{
@@ -1390,6 +1449,7 @@
{
/* look in main table */
g_string_free (buf, TRUE);
+ timer_update_profile( TIMER_FUNC_G );
return (oc_find_cached_object_by_key (classname, key));
}
if (debuglevel == OC_TEMP_DEBUG)
@@ -1397,10 +1457,15 @@
printf ("could not find index %s\n", buf->str);
}
g_string_free (buf, TRUE);
+ timer_update_profile( TIMER_FUNC_G );
return (NULL);
}
- g_string_free (buf, TRUE);
+ g_string_free (buf, TRUE);
+ timer_update_profile( TIMER_FUNC_G );
+
+
/* make appropriate object hash key for finding 'classname' in 'idx' */
+ timer_start_profile( TIMER_FUNC_H );
buf = g_string_new ("");
l = idx->index->fields;
while (l)
@@ -1447,13 +1512,16 @@
printf ("OCCACHE: failed\n");
}
g_string_free (buf, TRUE);
+ timer_update_profile( TIMER_FUNC_H );
return (NULL);
}
l = g_list_next (l);
}
+ timer_update_profile( TIMER_FUNC_H );
/* found an index, now look for the object in that index */
+ timer_start_profile( TIMER_FUNC_I );
if (debuglevel == OC_TEMP_DEBUG)
{
printf ("OCCACHE: looking for '%s' in index\n", buf->str);
@@ -1463,10 +1531,12 @@
if (!link)
{
+ timer_update_profile( TIMER_FUNC_I );
return (NULL);
}
if (!link->objects)
{
+ timer_update_profile( TIMER_FUNC_I );
return (NULL);
}
if (debuglevel == OC_TEMP_DEBUG)
@@ -1474,6 +1544,7 @@
printf ("OCCACHE: found\n");
}
fflush (NULL);
+ timer_update_profile( TIMER_FUNC_I );
return (link->objects->data);
}
Index: gnue/geas/src/objectcache/objectcache.h
diff -u gnue/geas/src/objectcache/objectcache.h:1.19
gnue/geas/src/objectcache/objectcache.h:1.20
--- gnue/geas/src/objectcache/objectcache.h:1.19 Tue Jun 12 20:33:03 2001
+++ gnue/geas/src/objectcache/objectcache.h Mon Jun 25 20:01:26 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: objectcache.h,v 1.19 2001/06/13 03:33:03 treshna Exp $
+ $Id: objectcache.h,v 1.20 2001/06/26 03:01:26 treshna Exp $
*/
@@ -90,5 +90,10 @@
void oc_set_object_userdata( ObjectData *obj , void *data );
void *oc_get_object_userdata( ObjectData *obj );
+
+void oc_print_stats( void );
+
+void oc_freeze( void );
+void oc_thaw( void );
#endif
Index: gnue/geas/src/objectlist.c
diff -u gnue/geas/src/objectlist.c:1.27 gnue/geas/src/objectlist.c:1.28
--- gnue/geas/src/objectlist.c:1.27 Wed Jun 13 06:23:51 2001
+++ gnue/geas/src/objectlist.c Mon Jun 25 20:01:26 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: objectlist.c,v 1.27 2001/06/13 13:23:51 baumannd Exp $
+ $Id: objectlist.c,v 1.28 2001/06/26 03:01:26 treshna Exp $
*/
@@ -77,8 +77,12 @@
/* GEAS_DataObject obj; */
GEAS_objectslist *retval = NULL;
int i, len;
+ ObjectData *obj;
+ GList *hacklist;
+ char *classname;
/* get length of list */
+timer_start_profile( TIMER_FUNC_D );
len = ObjectList__get_length (id, ev);
if (ev->_major != CORBA_NO_EXCEPTION)
{
@@ -95,11 +99,111 @@
retval->_length = len;
retval->_buffer = CORBA_sequence_GEAS_DataObject_allocbuf (retval->_length);
+ obj = oc_find_cached_object_by_key( "geas::listholder" , id->listid );
+ classname = oc_get_object_field( obj , "classname" );
+ hacklist = oc_get_object_userdata( obj );
+timer_update_profile( TIMER_FUNC_D );
+
+#if 0
+xyz
+ i = 0;
+ while( hacklist )
+ {
+ dataobj = (ObjectData *)hacklist->data;
+ objid = oc_get_object_key( dataobj );
+ retval->_buffer[i] = make_dataobject_reference( classname , objid ,
id->username , id->sessionid , ev );
+
+ hacklist = g_list_next( hacklist );
+ i++;
+ }
+ g_free( classname );
+
+#else
+timer_start_profile( TIMER_FUNC_TEMP1 );
for (i = 0; i < len; i++)
{
+ GEAS_DataObject xretval = CORBA_OBJECT_NIL;
+ /* GEAS_DataObject lst; */
+ int len;
+ char *key, *classname = NULL, *pos;
+ QueryData *q;
+ int index = i;
+timer_start_profile( TIMER_FUNC_GETENTRY );
+timer_start_profile( TIMER_FUNC_A );
+
+ len = ObjectList__get_length (id, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+timer_update_profile( TIMER_FUNC_GETENTRY );
+ return (CORBA_OBJECT_NIL);
+ }
+
+ {
+ /* find listholder where listholder.objectid = id.listid, to read
+ classname */
+ ObjectData *ob;
+
+ ob = oc_find_object_by_key ("geas::listholder", id->listid);
+ classname = oc_get_object_field (ob, "classname");
+timer_update_profile( TIMER_FUNC_A );
+
+ /* create query */
+timer_start_profile( TIMER_FUNC_B );
+ q = oql_load_object ("geas::listitem");
+ if (!q)
+ {
+ make_ServerError_exception (ev, "Could not create query");
+ g_free (classname);
+timer_update_profile( TIMER_FUNC_B );
+ return (CORBA_OBJECT_NIL);
+ }
+ oql_add_query_constraint (q, NULL, id->listid, "=", "geas::listitem",
+ "listid");
+ pos = g_strdup_printf ("%d", index);
+ oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
+ "position");
+ g_free (pos);
+ /* WHERE geas::listitem.listid = id->listid AND
+ * geas::listitem.position = index
+ */
+timer_update_profile( TIMER_FUNC_B );
+
+ ob = oc_search_for_single_object (q);
+ if (ob)
+ {
+ ObjectData *xyz; /* sensible variable names? this is already a
nasty hack, so why start being sensible now? */
+
+timer_start_profile( TIMER_FUNC_C );
+ key = oc_get_object_field (ob, "reference");
+timer_start_profile( TIMER_FUNC_MAKEREF );
+
+
+ xyz = oc_find_object_by_key( classname , key );
+
+ xretval = oc_get_object_userdata( xyz );
+ if( xretval == NULL ) {
+ xretval =
+ make_dataobject_reference (classname, key, id->username,
+ id->sessionid, ev);
+ oc_set_object_userdata( xyz , (void *)xretval );
+ if( oc_get_object_userdata(xyz) == NULL ) printf( "hey!\n" );
+ }
+
+
+
+timer_update_profile( TIMER_FUNC_MAKEREF );
+ g_free (key);
+ oql_free_query (q);
+timer_update_profile( TIMER_FUNC_C );
+timer_update_profile( TIMER_FUNC_GETENTRY );
+
/* add object reference to the list */
- retval->_buffer[i] = ObjectList_getEntry (id, i, ev);
+ retval->_buffer[i] = CORBA_Object_duplicate(xretval,ev);
+ }
}
+ }
+timer_update_profile( TIMER_FUNC_TEMP1 );
+#endif
return (retval);
}
@@ -127,10 +231,13 @@
int err;
char *errmsg;
int idx;
+timer_start_profile( TIMER_FUNC_GETENTRY );
+timer_start_profile( TIMER_FUNC_A );
len = ObjectList__get_length (id, ev);
if (ev->_major != CORBA_NO_EXCEPTION)
{
+timer_update_profile( TIMER_FUNC_GETENTRY );
return (CORBA_OBJECT_NIL);
}
if (index >= len)
@@ -155,13 +262,16 @@
ob = oc_find_object_by_key ("geas::listholder", id->listid);
classname = oc_get_object_field (ob, "classname");
+timer_update_profile( TIMER_FUNC_A );
/* create query */
+timer_start_profile( TIMER_FUNC_B );
q = oql_load_object ("geas::listitem");
if (!q)
{
make_ServerError_exception (ev, "Could not create query");
g_free (classname);
+timer_update_profile( TIMER_FUNC_B );
return (CORBA_OBJECT_NIL);
}
oql_add_query_constraint (q, NULL, id->listid, "=", "geas::listitem",
@@ -173,19 +283,27 @@
/* WHERE geas::listitem.listid = id->listid AND
* geas::listitem.position = index
*/
+timer_update_profile( TIMER_FUNC_B );
+
ob = oc_search_for_single_object (q);
if (ob)
{
+timer_start_profile( TIMER_FUNC_C );
key = oc_get_object_field (ob, "reference");
+timer_start_profile( TIMER_FUNC_MAKEREF );
retval =
make_dataobject_reference (classname, key, id->username,
id->sessionid, ev);
+timer_update_profile( TIMER_FUNC_MAKEREF );
g_free (key);
oql_free_query (q);
+timer_update_profile( TIMER_FUNC_C );
+timer_update_profile( TIMER_FUNC_GETENTRY );
return (retval);
}
/* perform the query */
+ printf( "searching object store\n" );
result = query_objectstore (q, &err, &errmsg);
if (errmsg || !result)
{
@@ -209,6 +327,7 @@
free_query_result (result);
}
g_free (classname);
+timer_update_profile( TIMER_FUNC_GETENTRY );
return (CORBA_OBJECT_NIL);
}
idx = oql_query_get_field_position (q, "reference");
@@ -223,6 +342,7 @@
{
g_free (classname);
}
+timer_update_profile( TIMER_FUNC_GETENTRY );
return (retval);
}
@@ -544,6 +664,7 @@
hacklist = (GList *)oc_get_object_userdata( ob );
hacklist2 = hacklist;
+ printf( "should be %d objects, found %d\n" , length ,
g_list_length(hacklist2) );
while(hacklist2)
{
oc_remove_object( hacklist2->data );
Index: gnue/geas/src/objectstore/postgresql.c
diff -u gnue/geas/src/objectstore/postgresql.c:1.9
gnue/geas/src/objectstore/postgresql.c:1.10
--- gnue/geas/src/objectstore/postgresql.c:1.9 Fri Jun 22 09:16:22 2001
+++ gnue/geas/src/objectstore/postgresql.c Mon Jun 25 20:01:26 2001
@@ -20,7 +20,7 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: postgresql.c,v 1.9 2001/06/22 16:16:22 reinhard Exp $
+ $Id: postgresql.c,v 1.10 2001/06/26 03:01:26 treshna Exp $
*/
#include "config.h"
@@ -310,7 +310,9 @@
retry:
tries++;
/* printf( "[%s]\n" , oql_query_as_sql(query,dbtype) ); */
+ timer_start_profile( TIMER_FUNC_EXECQUERY );
res = PQexec (conn->handle, oql_query_as_sql (query, dbtype));
+ timer_update_profile( TIMER_FUNC_EXECQUERY );
PQerrorcode = PQresultStatus (res);
#if 0
if (PQerrorcode != PGRES_FATAL_ERROR)
@@ -340,6 +342,7 @@
{
/* message ("[ok, data rows expected] rows affected: %d",
result->rows_affected ); */
+ timer_start_profile( TIMER_FUNC_HANDLERESULTS );
result->rows_affected = PQntuples (res);
result->field_count = PQnfields (res);
result->success = TRUE;
@@ -376,6 +379,7 @@
if (res != NULL)
PQclear (res);
res = NULL;
+ timer_update_profile( TIMER_FUNC_HANDLERESULTS );
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/geas/src collectiondata.c connection.c dat...,
Treshna Enterprises <=