mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 08:58:03 +02:00
[perf] Support parsing reports from stdin
This commit is contained in:
parent
50163a9faf
commit
f23ae97e30
2 changed files with 31 additions and 20 deletions
|
|
@ -363,16 +363,18 @@ main (int argc, const char *argv[])
|
||||||
|
|
||||||
parse_args (argc, argv, &args);
|
parse_args (argc, argv, &args);
|
||||||
|
|
||||||
if (args.num_filenames < 1)
|
if (args.num_filenames) {
|
||||||
usage (argv[0]);
|
reports = xcalloc (args.num_filenames, sizeof (cairo_perf_report_t));
|
||||||
|
for (i = 0; i < args.num_filenames; i++) {
|
||||||
reports = xcalloc (args.num_filenames, sizeof (cairo_perf_report_t));
|
cairo_perf_report_load (&reports[i], args.filenames[i],
|
||||||
|
test_report_cmp_name);
|
||||||
for (i = 0; i < args.num_filenames; i++) {
|
printf ("loaded: %s, %d tests\n",
|
||||||
cairo_perf_report_load (&reports[i], args.filenames[i],
|
args.filenames[i], reports[i].tests_count);
|
||||||
test_report_cmp_name);
|
}
|
||||||
printf ("loaded: %s, %d tests\n",
|
} else {
|
||||||
args.filenames[i], reports[i].tests_count);
|
args.num_filenames = 1;
|
||||||
|
reports = xcalloc (args.num_filenames, sizeof (cairo_perf_report_t));
|
||||||
|
cairo_perf_report_load (&reports[0], NULL, test_report_cmp_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_perf_reports_compare (reports, args.num_filenames, &args.options);
|
cairo_perf_reports_compare (reports, args.num_filenames, &args.options);
|
||||||
|
|
|
||||||
|
|
@ -437,9 +437,14 @@ cairo_perf_report_load (cairo_perf_report_t *report,
|
||||||
char *configuration;
|
char *configuration;
|
||||||
char *dot;
|
char *dot;
|
||||||
char *baseName;
|
char *baseName;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
configuration = xmalloc (strlen (filename) * sizeof (char) + 1);
|
name = filename;
|
||||||
strcpy (configuration, filename);
|
if (name == NULL)
|
||||||
|
name = "stdin";
|
||||||
|
|
||||||
|
configuration = xmalloc (strlen (name) * sizeof (char) + 1);
|
||||||
|
strcpy (configuration, name);
|
||||||
baseName = basename (configuration);
|
baseName = basename (configuration);
|
||||||
report->configuration = xmalloc (strlen (baseName) * sizeof (char) + 1);
|
report->configuration = xmalloc (strlen (baseName) * sizeof (char) + 1);
|
||||||
strcpy (report->configuration, baseName);
|
strcpy (report->configuration, baseName);
|
||||||
|
|
@ -449,16 +454,20 @@ cairo_perf_report_load (cairo_perf_report_t *report,
|
||||||
if (dot)
|
if (dot)
|
||||||
*dot = '\0';
|
*dot = '\0';
|
||||||
|
|
||||||
report->name = filename;
|
report->name = name;
|
||||||
report->tests_size = 16;
|
report->tests_size = 16;
|
||||||
report->tests = xmalloc (report->tests_size * sizeof (test_report_t));
|
report->tests = xmalloc (report->tests_size * sizeof (test_report_t));
|
||||||
report->tests_count = 0;
|
report->tests_count = 0;
|
||||||
|
|
||||||
file = fopen (filename, "r");
|
if (filename == NULL) {
|
||||||
if (file == NULL) {
|
file = stdin;
|
||||||
fprintf (stderr, "Failed to open %s: %s\n",
|
} else {
|
||||||
filename, strerror (errno));
|
file = fopen (filename, "r");
|
||||||
exit (1);
|
if (file == NULL) {
|
||||||
|
fprintf (stderr, "Failed to open %s: %s\n",
|
||||||
|
filename, strerror (errno));
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
@ -485,7 +494,8 @@ cairo_perf_report_load (cairo_perf_report_t *report,
|
||||||
if (line)
|
if (line)
|
||||||
free (line);
|
free (line);
|
||||||
|
|
||||||
fclose (file);
|
if (filename != NULL)
|
||||||
|
fclose (file);
|
||||||
|
|
||||||
cairo_perf_report_sort_and_compute_stats (report, cmp);
|
cairo_perf_report_sort_and_compute_stats (report, cmp);
|
||||||
|
|
||||||
|
|
@ -497,4 +507,3 @@ cairo_perf_report_load (cairo_perf_report_t *report,
|
||||||
}
|
}
|
||||||
report->tests[report->tests_count].name = NULL;
|
report->tests[report->tests_count].name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue