aboutsummaryrefslogtreecommitdiffstats
path: root/trace-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-record.c')
-rw-r--r--trace-record.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/trace-record.c b/trace-record.c
index 62758e8..45439f4 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -1426,8 +1426,6 @@ static void start_threads(void)
1426{ 1426{
1427 int i; 1427 int i;
1428 1428
1429 cpu_count = count_cpus();
1430
1431 if (host) 1429 if (host)
1432 setup_network(); 1430 setup_network();
1433 1431
@@ -1905,7 +1903,7 @@ void trace_record (int argc, char **argv)
1905 struct event_list *event; 1903 struct event_list *event;
1906 struct event_list *last_event; 1904 struct event_list *last_event;
1907 struct tracecmd_event_list *list; 1905 struct tracecmd_event_list *list;
1908 struct trace_seq s; 1906 struct trace_seq *s;
1909 char *date2ts = NULL; 1907 char *date2ts = NULL;
1910 int record_all = 0; 1908 int record_all = 0;
1911 int disable = 0; 1909 int disable = 0;
@@ -1921,6 +1919,8 @@ void trace_record (int argc, char **argv)
1921 1919
1922 int c; 1920 int c;
1923 1921
1922 cpu_count = count_cpus();
1923
1924 if ((record = (strcmp(argv[1], "record") == 0))) 1924 if ((record = (strcmp(argv[1], "record") == 0)))
1925 ; /* do nothing */ 1925 ; /* do nothing */
1926 else if (strcmp(argv[1], "start") == 0) 1926 else if (strcmp(argv[1], "start") == 0)
@@ -2184,6 +2184,8 @@ void trace_record (int argc, char **argv)
2184 2184
2185 set_options(); 2185 set_options();
2186 2186
2187 s = malloc_or_die(sizeof(*s) * cpu_count);
2188
2187 if (record || extract) { 2189 if (record || extract) {
2188 signal(SIGINT, finish); 2190 signal(SIGINT, finish);
2189 if (!latency) 2191 if (!latency)
@@ -2219,6 +2221,11 @@ void trace_record (int argc, char **argv)
2219 2221
2220 stop_threads(); 2222 stop_threads();
2221 2223
2224 for (cpu = 0; cpu < cpu_count; cpu++) {
2225 trace_seq_init(&s[cpu]);
2226 trace_seq_printf(&s[cpu], "CPU: %d\n", cpu);
2227 tracecmd_stat_cpu(&s[cpu], cpu);
2228 }
2222 2229
2223 if (!keep) 2230 if (!keep)
2224 disable_all(); 2231 disable_all();
@@ -2227,14 +2234,12 @@ void trace_record (int argc, char **argv)
2227 " Note: \"entries\" are the entries left in the kernel ring buffer and are not\n" 2234 " Note: \"entries\" are the entries left in the kernel ring buffer and are not\n"
2228 " recorded in the trace data. They should all be zero.\n\n"); 2235 " recorded in the trace data. They should all be zero.\n\n");
2229 for (cpu = 0; cpu < cpu_count; cpu++) { 2236 for (cpu = 0; cpu < cpu_count; cpu++) {
2230 trace_seq_init(&s); 2237 trace_seq_do_printf(&s[cpu]);
2231 trace_seq_printf(&s, "CPU: %d\n", cpu); 2238 trace_seq_destroy(&s[cpu]);
2232 tracecmd_stat_cpu(&s, cpu);
2233 trace_seq_do_printf(&s);
2234 trace_seq_destroy(&s);
2235 printf("\n"); 2239 printf("\n");
2236 } 2240 }
2237 2241
2242
2238 /* extract records the date after extraction */ 2243 /* extract records the date after extraction */
2239 if (extract && date) 2244 if (extract && date)
2240 date2ts = get_date_to_ts(); 2245 date2ts = get_date_to_ts();