int pscount;
int cpus;
double interval;
-FILE *of;
+FILE *of = NULL;
int overrun = 0;
static int exiting = 0;
double scale_y = 20.0; /* 16px = 1 process bar */
char init_path[PATH_MAX] = "/sbin/init";
-char output_path[PATH_MAX] = "/var/log";
+char output_path[PATH_MAX] = "/run/log";
static struct rlimit rlim;
execl(init_path, init_path, NULL);
}
}
+ argv[0][0] = '@';
/* start with empty ps LL */
ps_first = calloc(1, sizeof(struct ps_struct));
sampletime[samples] = gettime_ns();
+ if (!of && (access(output_path, R_OK|W_OK|X_OK) == 0)) {
+ t = time(NULL);
+ strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", output_path, datestr);
+ of = fopen(output_file, "w");
+ }
+
+
/* wait for /proc to become available, discarding samples */
if (!(graph_start > 0.0))
log_uptime();
}
closedir(proc);
- t = time(NULL);
- strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
- snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", output_path, datestr);
+ if (!of) {
+ t = time(NULL);
+ strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", output_path, datestr);
+ of = fopen(output_file, "w");
+ }
- of = fopen(output_file, "w");
if (!of) {
perror("open output_file");
exit (EXIT_FAILURE);