static int test_perf(int argc, char *argv[]) { perf_counter_t cc, ec; cc = perf_alloc(PC_COUNT, "test_count"); ec = perf_alloc(PC_ELAPSED, "test_elapsed"); if ((cc == NULL) || (ec == NULL)) { printf("perf: counter alloc failed\n"); return 1; } perf_begin(ec); perf_count(cc); perf_count(cc); perf_count(cc); perf_count(cc); printf("perf: expect count of 4\n"); perf_print_counter(cc); perf_end(ec); printf("perf: expect count of 1\n"); perf_print_counter(ec); printf("perf: expect at least two counters\n"); perf_print_all(0); perf_free(cc); perf_free(ec); return OK; }
int main() { test_setup(); perf_start(); for (int i = 0; i < NUM_ITER; ++i) { test_clear(); reset_timer(); start_timer(); test_run(i); stop_timer(); samples[i] = get_time(); } perf_stop(); int check = test_check(); printf("Correct: %d\n", check); for (int i = 0; i < NUM_ITER; ++i) printf("TS[%d]: %d\n", i, samples[i]); perf_print_all(); return 0; }
int perf_main(int argc, char *argv[]) { if (argc > 1) { if (strcmp(argv[1], "reset") == 0) { perf_reset_all(); return 0; } #if 0 else if (strcmp(argv[1], "latency") == 0) { perf_print_latency(1 /* stdout */); fflush(stdout); return 0; } #endif printf("Usage: perf [reset]\n"); return -1; } perf_print_all(1 /* stdout */); //fflush(stdout); return 0; }
int perf_main(int argc, char *argv[]) { if (argc > 1) { if (strcmp(argv[1], "reset") == 0) { perf_reset_all(); return 0; } else if (strcmp(argv[1], "latency") == 0) { perf_print_latency(1 /* stdout */); fflush(stdout); return 0; } print_usage(); return -1; } perf_print_all(1 /* stdout */); fflush(stdout); return 0; }
int perf_main(int argc, char *argv[]) { perf_print_all(); fflush(stdout); return 0; }