Record benchmark workload phases
This commit is contained in:
@@ -221,15 +221,24 @@ struct background_metrics {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_TELEMETRY_SAMPLES 1800
|
#define MAX_TELEMETRY_SAMPLES 1800
|
||||||
|
#define MAX_TELEMETRY_PHASES 44
|
||||||
|
|
||||||
struct telemetry_sample {
|
struct telemetry_sample {
|
||||||
uint64_t elapsed_ms;
|
uint64_t elapsed_ms;
|
||||||
double temperature_c, clock_mhz;
|
double temperature_c, clock_mhz;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct telemetry_phase {
|
||||||
|
uint64_t elapsed_ms;
|
||||||
|
const char *suite, *mode;
|
||||||
|
int workload_index;
|
||||||
|
};
|
||||||
|
|
||||||
struct telemetry_monitor {
|
struct telemetry_monitor {
|
||||||
struct telemetry_sample samples[MAX_TELEMETRY_SAMPLES];
|
struct telemetry_sample samples[MAX_TELEMETRY_SAMPLES];
|
||||||
size_t count;
|
size_t count;
|
||||||
|
struct telemetry_phase phases[MAX_TELEMETRY_PHASES];
|
||||||
|
size_t phase_count;
|
||||||
double started;
|
double started;
|
||||||
volatile int stop;
|
volatile int stop;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -239,6 +248,19 @@ struct telemetry_monitor {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void record_telemetry_phase(struct telemetry_monitor *monitor,
|
||||||
|
const char *suite, int workload_index,
|
||||||
|
const char *mode)
|
||||||
|
{
|
||||||
|
struct telemetry_phase *phase;
|
||||||
|
if (monitor->phase_count >= MAX_TELEMETRY_PHASES) return;
|
||||||
|
phase = &monitor->phases[monitor->phase_count++];
|
||||||
|
phase->elapsed_ms = (uint64_t)((now_seconds() - monitor->started) * 1000.0);
|
||||||
|
phase->suite = suite;
|
||||||
|
phase->workload_index = workload_index;
|
||||||
|
phase->mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
static int read_number_file(const char *path, double *value)
|
static int read_number_file(const char *path, double *value)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(path, "r");
|
FILE *f = fopen(path, "r");
|
||||||
@@ -1041,7 +1063,9 @@ int fossbench_run(int verbose, int upload_mode, int system_check)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/* Run every test with all cores and one core. */
|
/* Run every test with all cores and one core. */
|
||||||
|
record_telemetry_phase(&telemetry, "asm", (int)i, "multicore");
|
||||||
raw_multi[i] = run_test(&tests[i], (int)g_ncores);
|
raw_multi[i] = run_test(&tests[i], (int)g_ncores);
|
||||||
|
record_telemetry_phase(&telemetry, "asm", (int)i, "singlecore");
|
||||||
raw_single[i] = run_test(&tests[i], 1);
|
raw_single[i] = run_test(&tests[i], 1);
|
||||||
|
|
||||||
printf(" %12.1f %-11s %7.2fs\n",
|
printf(" %12.1f %-11s %7.2fs\n",
|
||||||
@@ -1062,7 +1086,9 @@ int fossbench_run(int verbose, int upload_mode, int system_check)
|
|||||||
for (i = 0; i < NTESTS; i++) {
|
for (i = 0; i < NTESTS; i++) {
|
||||||
printf(" %-24s", tests[i].name);
|
printf(" %-24s", tests[i].name);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
record_telemetry_phase(&telemetry, "c", (int)i, "multicore");
|
||||||
real_multi[i] = run_test(&tests[i], (int)g_ncores);
|
real_multi[i] = run_test(&tests[i], (int)g_ncores);
|
||||||
|
record_telemetry_phase(&telemetry, "c", (int)i, "singlecore");
|
||||||
real_single[i] = run_test(&tests[i], 1);
|
real_single[i] = run_test(&tests[i], 1);
|
||||||
printf(" %12.1f %-11s %7.2fs\n",
|
printf(" %12.1f %-11s %7.2fs\n",
|
||||||
display_metric(&tests[i], &real_multi[i]), tests[i].unit,
|
display_metric(&tests[i], &real_multi[i]), tests[i].unit,
|
||||||
|
|||||||
@@ -246,6 +246,21 @@ static int upload_results(const struct system_info *info,
|
|||||||
used += (size_t)n;
|
used += (size_t)n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
n = snprintf(payload + used, sizeof payload - used, "],\"telemetry_phases\":[");
|
||||||
|
if (n < 0 || (size_t)n >= sizeof payload - used) return 0;
|
||||||
|
used += (size_t)n;
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < telemetry->phase_count; i++) {
|
||||||
|
const struct telemetry_phase *phase = &telemetry->phases[i];
|
||||||
|
n = snprintf(payload + used, sizeof payload - used,
|
||||||
|
"%s{\"elapsed_ms\":%llu,\"suite\":\"%s\",\"workload_index\":%d,\"mode\":\"%s\"}",
|
||||||
|
i ? "," : "", (unsigned long long)phase->elapsed_ms,
|
||||||
|
phase->suite, phase->workload_index, phase->mode);
|
||||||
|
if (n < 0 || (size_t)n >= sizeof payload - used) return 0;
|
||||||
|
used += (size_t)n;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (used + 4 >= sizeof payload) return 0;
|
if (used + 4 >= sizeof payload) return 0;
|
||||||
memcpy(payload + used, "]}}", 4);
|
memcpy(payload + used, "]}}", 4);
|
||||||
payload_len = (int)(used + 3);
|
payload_len = (int)(used + 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user