mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-06 06:25:55 +03:00
load pier directory on serf for saving tracing files
This commit is contained in:
parent
5c88da2619
commit
03ae60505b
@ -541,6 +541,7 @@
|
|||||||
c3_w nid_w; // nock pid
|
c3_w nid_w; // nock pid
|
||||||
FILE* fil_u; // trace file (json)
|
FILE* fil_u; // trace file (json)
|
||||||
c3_w con_w; // trace counter
|
c3_w con_w; // trace counter
|
||||||
|
c3_w fun_w; // file counter
|
||||||
} u3_trac;
|
} u3_trac;
|
||||||
|
|
||||||
/* u3_opts: command line configuration.
|
/* u3_opts: command line configuration.
|
||||||
|
@ -762,6 +762,7 @@ main(c3_i argc,
|
|||||||
u3_Host.tra_u.nid_w = 0;
|
u3_Host.tra_u.nid_w = 0;
|
||||||
u3_Host.tra_u.fil_u = NULL;
|
u3_Host.tra_u.fil_u = NULL;
|
||||||
u3_Host.tra_u.con_w = 0;
|
u3_Host.tra_u.con_w = 0;
|
||||||
|
u3_Host.tra_u.fun_w = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,19 +346,16 @@ u3t_flee(void)
|
|||||||
void
|
void
|
||||||
u3t_trace_open()
|
u3t_trace_open()
|
||||||
{
|
{
|
||||||
|
|
||||||
c3_c fil_c[2048];
|
c3_c fil_c[2048];
|
||||||
snprintf(fil_c, 2048, "%s/.urb/put/trace", u3_Host.dir_c);
|
snprintf(fil_c, 2048, "%s/.urb/put/trace", u3C.dir_c);
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if ( -1 == stat(fil_c, &st) ) {
|
if ( -1 == stat(fil_c, &st) ) {
|
||||||
mkdir(fil_c, 0700);
|
mkdir(fil_c, 0700);
|
||||||
}
|
}
|
||||||
|
|
||||||
c3_c * wen_c = u3r_string(u3A->wen);
|
|
||||||
c3_c lif_c[2048];
|
c3_c lif_c[2048];
|
||||||
snprintf(lif_c, 2048, "%s/%s.json", fil_c, wen_c);
|
snprintf(lif_c, 2048, "%s/%d.json", fil_c, u3_Host.tra_u.fun_w);
|
||||||
free(wen_c);
|
|
||||||
|
|
||||||
u3_Host.tra_u.fil_u = fopen(lif_c, "w");
|
u3_Host.tra_u.fil_u = fopen(lif_c, "w");
|
||||||
u3_Host.tra_u.nid_w = (int)getpid();
|
u3_Host.tra_u.nid_w = (int)getpid();
|
||||||
@ -402,6 +399,7 @@ u3t_trace_close()
|
|||||||
// We don't terminate the JSON because of the file format.
|
// We don't terminate the JSON because of the file format.
|
||||||
fclose(u3_Host.tra_u.fil_u);
|
fclose(u3_Host.tra_u.fil_u);
|
||||||
u3_Host.tra_u.con_w = 0;
|
u3_Host.tra_u.con_w = 0;
|
||||||
|
u3_Host.tra_u.fun_w++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* u3t_trace_time(): microsecond clock
|
/* u3t_trace_time(): microsecond clock
|
||||||
|
@ -762,6 +762,37 @@ main(c3_i argc, c3_c* argv[])
|
|||||||
sscanf(wag_c, "%" SCNu32, &u3C.wag_w);
|
sscanf(wag_c, "%" SCNu32, &u3C.wag_w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* load pier directory
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
c3_i abs_i = 1000;
|
||||||
|
c3_c* abs_c = c3_malloc(abs_i);
|
||||||
|
|
||||||
|
while ( abs_c != getcwd(abs_c, abs_i) ) {
|
||||||
|
free(abs_c);
|
||||||
|
abs_i *= 2;
|
||||||
|
abs_c = c3_malloc(abs_i);
|
||||||
|
}
|
||||||
|
|
||||||
|
c3_i ful_i = abs_i + strlen(dir_c);
|
||||||
|
c3_c* ful_c = c3_malloc(ful_i);
|
||||||
|
snprintf(ful_c, ful_i, "%s/%s", abs_c, dir_c);
|
||||||
|
|
||||||
|
u3C.dir_c = strdup(ful_c);
|
||||||
|
|
||||||
|
free(ful_c);
|
||||||
|
free(abs_c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear tracing struct
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
u3_Host.tra_u.nid_w = 0;
|
||||||
|
u3_Host.tra_u.fil_u = NULL;
|
||||||
|
u3_Host.tra_u.con_w = 0;
|
||||||
|
u3_Host.tra_u.fun_w = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* boot image
|
/* boot image
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user