Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18380/mal

Modified Files:
        mal_client.mx mal_scenario.mx 
Log Message:
Add a few statistics for tracking client behavior.


Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- mal_client.mx       30 Aug 2007 07:18:54 -0000      1.156
+++ mal_client.mx       5 Sep 2007 18:13:16 -0000       1.157
@@ -89,6 +89,10 @@
 # include <sys/resource.h>
 #endif
 
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
 @-
 The prompt structure is designed to simplify recognition
 of the language framework for interaction. For direct console
@@ -226,6 +230,18 @@
        Symbol      curprg;     /* focus of parser */
        Symbol      backup;     /* save parsing context */
        MalStkPtr   glb;        /* global variable stack */
[EMAIL PROTECTED]
+Some statistics on client behavior becomes relevant
+for server maintenance. The scenario loop is used as
+a frame of reference. We measure the elapsed time after
+a request has been received and we have to wait for
+the next one. 
[EMAIL PROTECTED]
+       int                     actions;
+       lng                     totaltime;      /* sum of elapsed processing 
times */
+#ifdef HAVE_TIMES
+       struct tms      workload;
+#endif
 } *Client, ClientRec;
 
 mal_export ClientRec mal_clients[MAL_MAXCLIENTS+1];
@@ -446,6 +462,9 @@
        prompt = !fin? GDKgetenv("monet_prompt"): PROMPT1;
        c->prompt= GDKstrdup(prompt);
        c->promptlength= strlen(prompt);
+
+       c->actions =0;
+       c->totaltime= 0;
        return c;
 }
 @-

Index: mal_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_scenario.mx,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- mal_scenario.mx     30 Aug 2007 07:18:54 -0000      1.111
+++ mal_scenario.mx     5 Sep 2007 18:13:16 -0000       1.112
@@ -183,6 +183,10 @@
 #include "mal_authorize.h"
 #include "mal_exception.h"
 
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
 struct SCENARIO scenarioRec[MAXSCEN] = {
        {"mal", "mal",
         0, 0,                  /* hardwired MALinit*/
@@ -576,15 +580,31 @@
 runScenarioBody(Client c)
 {
        str msg= MAL_SUCCEED;
+       lng start;
+       struct tms t0,t1;
 
        while (c->mode > FINISHING) {
                msg = MAL_SUCCEED;
                @:runPhase(MAL_SCENARIO_READER)@
                c->lastcmd= time(0);
+               start= GDKusec();
+#ifdef HAVE_TIMES
+               times(&t0);
+#endif
                @:runPhase(MAL_SCENARIO_PARSER)@
                @:runPhase(MAL_SCENARIO_OPTIMIZE)@
                @:runPhase(MAL_SCENARIO_SCHEDULER)@
                @:runPhase(MAL_SCENARIO_ENGINE)@
+               start= GDKusec()-start;
+               c->actions++;
+               c->totaltime += start;
+#ifdef HAVE_TIMES
+               times(&t1);
+               c->workload.tms_utime += t1.tms_utime-t0.tms_utime;
+               c->workload.tms_cutime += t1.tms_cutime-t0.tms_cutime;
+               c->workload.tms_stime += t1.tms_stime-t0.tms_stime;
+               c->workload.tms_cstime += t1.tms_cstime-t0.tms_cstime;
+#endif
        }
        return msg;
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to