name trace files by urbit date

This commit is contained in:
Isaac Visintainer 2019-02-01 14:22:29 -08:00
parent 323c453404
commit 29d80e2887
3 changed files with 12 additions and 2 deletions

View File

@ -319,7 +319,10 @@ u3t_trace_open()
mkdir(fil_c, 0700);
}
snprintf(fil_c, 2048, "%s/%ld.json", fil_c, time(NULL));
c3_c * wen_c = u3r_string(u3A->wen);
snprintf(fil_c, 2048, "%s/%s.json", fil_c, wen_c);
free(wen_c);
trace_file_u = fopen(fil_c, "w");
nock_pid_i = (int)getpid();
@ -497,6 +500,11 @@ u3t_event_trace(const c3_c* name, c3_c type)
if (!trace_file_u)
return;
if ( trace_counter >= 100000 ) {
u3t_trace_close();
u3t_trace_open();
}
fprintf(trace_file_u,
"{\"cat\": \"event\", \"name\": \"%s\", \"ph\":\"%c\", \"pid\": %d, "
"\"tid\": 1, \"ts\": %" PRIu64 ", \"id\": \"0x100\"}, \n",

View File

@ -102,6 +102,9 @@ u3v_start(u3_noun now)
printf("arvo: time: %s\n", wen_c);
free(wen_c);
}
if ( u3C.wag_w & u3o_trace )
u3t_trace_open();
}
/* u3v_wish(): text expression with cache.

View File

@ -656,7 +656,6 @@ main(c3_i argc,
*/
if ( _(u3_Host.ops_u.tra) ) {
u3C.wag_w |= u3o_trace;
u3t_trace_open();
}
}
u3m_boot(u3_Host.ops_u.nuu,