void timer_stop( const char *id) { long int diff = 0; gettimeofday(&stopTime, 0); print_measurement(id, startTime, stopTime, &diff); }
int main(int argc, char **argv) { vmi_instance_t vmi; addr_t start_address; struct timeval ktv_start; struct timeval ktv_end; char *vm = argv[1]; int buf_size = atoi(argv[2]); int loops = atoi(argv[3]); int mode = atoi(argv[4]); unsigned char *buf = malloc(buf_size); int i = 0; long int diff; long int *data = malloc(loops * sizeof(long int)); int j = 0; uint32_t value = 0; if (mode != 1 && mode != 2) { printf("invalid mode\n"); return 1; } /* initialize the xen access library */ vmi_init(&vmi, VMI_AUTO | VMI_INIT_COMPLETE, vm); /* find address to work from */ start_address = vmi_translate_ksym2v(vmi, "PsInitialSystemProcess"); start_address = vmi_translate_kv2p(vmi, start_address); for (i = 0; i < loops; ++i) { if (mode == 1) { gettimeofday(&ktv_start, 0); vmi_read_pa(vmi, start_address, buf, buf_size); gettimeofday(&ktv_end, 0); } else { gettimeofday(&ktv_start, 0); for (j = 0; j < buf_size / 4; ++j) { vmi_read_32_pa(vmi, start_address + j * 4, &value); } gettimeofday(&ktv_end, 0); } print_measurement(ktv_start, ktv_end, &diff); data[i] = diff; memset(buf, 0, buf_size); sleep(1); } avg_measurement(data, loops); vmi_destroy(vmi); free(buf); return 0; }
static void cdash_show_pass(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { double exectime; CDashMemo *memo; const char *name = get_current_from_breadcrumb((CgreenBreadcrumb *)reporter->breadcrumb); (void)message; (void)arguments; memo = (CDashMemo *)reporter->memo; memo->testfinished = cdash_current_time(NULL); exectime = cdash_elapsed_time(memo->teststarted, memo->testfinished); print_test_header(memo, "passed", name, file, line); print_results_header(memo, name, exectime); print_measurement(memo, ""); print_tail(memo); }
static void show_incomplete(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { const char *name; char buffer[1000]; float exectime; CDashMemo *memo; memo = (CDashMemo *)reporter->memo; memo->testfinished = cdash_current_time(NULL); exectime = (float)cdash_elapsed_time(memo->teststarted, memo->testfinished); name = get_current_from_breadcrumb((CgreenBreadcrumb *)reporter->breadcrumb); print_test_header(memo, "incomplete", name, file, line); print_results_header(memo, name, exectime); vsprintf(buffer, (message == NULL ? "Problem" : message), arguments); print_measurement(memo, buffer); print_tail(memo); }
int main(int argc, char **argv) { vmi_instance_t vmi; addr_t vaddr; struct timeval ktv_start; struct timeval ktv_end; char *vm = argv[1]; int loops = atoi(argv[2]); int i = 0; long int diff; long int *data = malloc(loops * sizeof(long int)); /* initialize the xen access library */ vmi_init(&vmi, VMI_AUTO | VMI_INIT_COMPLETE, vm); for (i = 0; i < loops; ++i) { gettimeofday(&ktv_start, 0); vaddr = vmi_translate_ksym2v(vmi, "PsGetCurrentThread"); gettimeofday(&ktv_end, 0); if (0 == vaddr) { perror("failed to lookup kernel symbol"); goto error_exit; } print_measurement(ktv_start, ktv_end, &diff); data[i] = diff; sleep(2); } avg_measurement(data, loops); error_exit: vmi_destroy(vmi); free(data); return 0; }