fix missing if trace active
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 7 Jun 2005 04:35:57 +0000 (04:35 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 7 Jun 2005 04:35:57 +0000 (04:35 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@942 04897980-b3bd-0310-b5e0-8ef037075253

genevent/genevent.c

index c4c4d5d2c31382489b37580d38a577881b9a0514..9cb9f1bcc6bf5adc5117ff4bba220c9a3bd9e219 100644 (file)
@@ -427,7 +427,9 @@ void generateStructFunc(FILE * fp, char * facName, unsigned long checksum){
     fprintf(fp, "\tunsigned long flags;\n");
     fprintf(fp, "\tstruct %s_%s_1* __1;\n\n", ev->name, facName);
 
-               fprintf(fp, "\tread_lock(&ltt_traces.traces_rwlock, flags);\n");
+               fprintf(fp, "\tread_lock(&ltt_traces.traces_rwlock);\n\n");
+               fprintf(fp,
+                               "\tif(ltt_traces.num_active_traces == 0) goto unlock_traces;\n\n");
 
     fprintf(fp, 
         "\tindex = ltt_get_index_from_facility(ltt_facility_%s_%X,\n"\
@@ -436,10 +438,12 @@ void generateStructFunc(FILE * fp, char * facName, unsigned long checksum){
     fprintf(fp,"\n");
 
     fprintf(fp, "\t/* Disable interrupts. */\n");
-    fprintf(fp, "\tlocal_irq_save(flags);\n");
+    fprintf(fp, "\tlocal_irq_save(flags);\n\n");
 
+               /* For each trace */
     fprintf(fp, "\tlist_for_each_entry(trace, &ltt_traces.head, list) {\n");
-    
+    fprintf(fp, "\t\tif(!trace->active) goto skip_trace;\n\n");
+               
                fprintf(fp, "\t\tunsigned int header_length = "
                                                                "ltt_get_event_header_size(trace);\n");
                fprintf(fp, "\t\tunsigned int event_length = header_length + length;\n");
@@ -578,13 +582,15 @@ void generateStructFunc(FILE * fp, char * facName, unsigned long checksum){
     fprintf(fp, "\t\trelay_commit(channel->rchan, buff, event_length);\n");
 
    /* End of traces iteration */
+    fprintf(fp, "skip_trace:\n\n");
     fprintf(fp, "\t}\n\n");
 
     fprintf(fp, "\t/* Re-enable interrupts */\n");
     fprintf(fp, "\tlocal_irq_restore(flags);\n");
     fprintf(fp, "\tpreempt_check_resched();\n");
-
-    
+               
+               fprintf(fp, "\n");
+    fprintf(fp, "unlock_traces:\n");
     fprintf(fp, "\tread_unlock(&ltt_traces.traces_rwlock);\n");
     //call trace function
     //fprintf(fp,"\n\t//call trace function\n");
This page took 0.0256769999999999 seconds and 4 git commands to generate.