Drop workload phase recording and slow telemetry sampling to 2/sec
The telemetry thread's per-core /sys scan was contending with the timed benchmark passes, and could corrupt the workload-size calibration step, causing run-to-run swings of up to 4x. Removing phase recording and dropping the sample rate from 4/sec to 2/sec brings runs back to <5% variance.
This commit is contained in:
+4
-27
@@ -173,6 +173,8 @@ extern uint64_t fb_c_chase(void **ptrs, uint64_t steps);
|
|||||||
# define REPEATS 3 /* Number of tries. */
|
# define REPEATS 3 /* Number of tries. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TELEMETRY_REFRESH_INTERVAL 0.5
|
||||||
|
|
||||||
/* Simple repeatable random numbers. */
|
/* Simple repeatable random numbers. */
|
||||||
|
|
||||||
static uint64_t rng_state = 0x853c49e6748fea9bULL;
|
static uint64_t rng_state = 0x853c49e6748fea9bULL;
|
||||||
@@ -220,25 +222,17 @@ struct background_metrics {
|
|||||||
int samples, available;
|
int samples, available;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#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)
|
||||||
@@ -248,19 +242,6 @@ 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");
|
||||||
@@ -420,7 +401,7 @@ static void *telemetry_entry(void *arg)
|
|||||||
double next = monitor->started;
|
double next = monitor->started;
|
||||||
while (!monitor->stop) {
|
while (!monitor->stop) {
|
||||||
double current = now_seconds();
|
double current = now_seconds();
|
||||||
if (current >= next) { record_telemetry_sample(monitor); next += 0.25; }
|
if (current >= next) { record_telemetry_sample(monitor); next += TELEMETRY_REFRESH_INTERVAL; }
|
||||||
telemetry_sleep();
|
telemetry_sleep();
|
||||||
}
|
}
|
||||||
record_telemetry_sample(monitor);
|
record_telemetry_sample(monitor);
|
||||||
@@ -1063,9 +1044,7 @@ 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",
|
||||||
@@ -1086,9 +1065,7 @@ 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,21 +246,6 @@ 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