void hook_start_roi_() { // trash the cache const int kAllocSize = 48 * 1024 * 2014; long *tmp = malloc(kAllocSize); int i; for (i = 0; i < kAllocSize / sizeof(long); i++) tmp[i] = 0; free(tmp); struct timeval t; gettimeofday(&t,NULL); time_begin = (double)t.tv_sec+(double)t.tv_usec*1e-6; //if (perf_event_fds == NULL) warnx("perfctr FDs not initialized"); //else perfctr_start(perf_event_fds, g_num_events); // perfctr_start(perf_event_fds2, g_num_events); oprofile_start(); }
static ssize_t enable_write(struct file *file, char const __user *buf, size_t count, loff_t *offset) { unsigned long val; int retval; if (*offset) return -EINVAL; retval = oprofilefs_ulong_from_user(&val, buf, count); if (retval) return retval; if (val) retval = oprofile_start(); else oprofile_stop(); if (retval) return retval; return count; }