Changeset: 095ebfccd433 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=095ebfccd433
Modified Files:
        monetdb5/mal/mal.h
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

Keep track on start time of instructions.
The stethoscope can ask for the current MAL instructions
in execution, but this calls for keeping the time in
the instructions itself, rather then generate them
in the profiler.


diffs (53 lines):

diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -170,10 +170,12 @@ typedef struct {
        MALfcn fcn;                                     /* resolved function 
address */
        struct MALBLK *blk;                     /* resolved MAL function 
address */
        /* inline statistics */
-       lng ticks;                                      /* total micro seconds 
spent */
+       struct timeval clock;           /* when the last call was started */
+       lng ticks;                                      /* total micro seconds 
spent in last call */
        int calls;                                      /* number of calls made 
to this instruction */
        lng totticks;                           /* total time spent on this 
instruction. */
-       lng rbytes,wbytes;                      /* accumulated number of bytes 
touched */
+       lng rbytes;                                     /* accumulated number 
of bytes read, currently ignored */
+       lng wbytes;                                     /* accumulated number 
of bytes produced */
        /* the core admin */
        str modname;                            /* module context */
        str fcnname;                            /* function name */
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -152,7 +152,10 @@ offlineProfilerEvent(MalBlkPtr mb, MalSt
        if (eventstream == NULL)
                return ;
 
-       gettimeofday(&clock, NULL);
+       if( start) // show when instruction was started
+               clock = pci->clock;
+       else 
+               gettimeofday(&clock, NULL);
        clk = clock.tv_sec;
 
        /* make basic profile event tuple  */
@@ -171,7 +174,7 @@ offlineProfilerEvent(MalBlkPtr mb, MalSt
 #endif
 #endif
        tbuf[19]=0;
-       logadd("\"%s.%06ld\",\t", tbuf+11, (long) clock.tv_usec);
+       logadd("\"%s.%06ld\",\t", tbuf+11, (long)clock.tv_usec);
        if( alter){
                logadd("\"user.%s[0]0\",\t",alter);
        } else {
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -168,6 +168,7 @@ runtimeProfileBegin(Client cntxt, MalBlk
        }
 
        /* always collect the MAL instruction execution time */
+       gettimeofday(&pci->clock,NULL);
        prof->ticks = GDKusec();
        /* emit the instruction upon start as well */
        
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to