void os_allstop(void) { if (perf_profiling_started()) { profiling_stop(); } if (perf_ll_started()) { ll_stop(); } if (perf_pqos_cmt_started()) { proc_pqos_func(NULL, os_pqos_cmt_proc_free); } if (perf_uncore_started()) { uncore_stop_all(); } }
/* ARGSUSED */ int os_preop_switch2profiling(cmd_t *cmd, boolean_t *smpl) { *smpl = B_FALSE; if (!perf_profiling_started()) { perf_allstop(); if (perf_profiling_start() != 0) { return (-1); } *smpl = B_TRUE; } if (perf_pqos_cmt_started()) { perf_pqos_cmt_stop(0, 0); *smpl = B_TRUE; } return (0); }
/* ARGSUSED */ int os_profiling_start(perf_ctl_t *ctl, perf_task_t *task) { if (perf_profiling_started()) { perf_status_set(PERF_STATUS_PROFILING_STARTED); debug_print(NULL, 2, "profiling started yet\n"); return (0); } os_allstop(); proc_ll_clear(NULL); if (profiling_start(ctl, (task_profiling_t *)(task)) != 0) { exit_msg_put("Fail to setup perf (probably permission denied)!\n"); debug_print(NULL, 2, "os_profiling_start failed\n"); perf_status_set(PERF_STATUS_PROFILING_FAILED); return (-1); } debug_print(NULL, 2, "os_profiling_start success\n"); perf_status_set(PERF_STATUS_PROFILING_STARTED); return (0); }