| 53 | } |
| 54 | |
| 55 | void loadProfiler() { |
| 56 | void* lib = dlopen(profiler_lib_path, RTLD_NOW | RTLD_GLOBAL); |
| 57 | if (lib == NULL) { |
| 58 | std::cerr << dlerror() << std::endl; |
| 59 | exit(1); |
| 60 | } |
| 61 | |
| 62 | _asprof_init = (asprof_init_t)dlsym(lib, "asprof_init"); |
| 63 | _asprof_execute = (asprof_execute_t)dlsym(lib, "asprof_execute"); |
| 64 | _asprof_error_str = (asprof_error_str_t)dlsym(lib, "asprof_error_str"); |
| 65 | |
| 66 | _asprof_init(); |
| 67 | } |
| 68 | |
| 69 | void startProfiler() { |
| 70 | asprof_error_t err = _asprof_execute("start,event=cpu,interval=1ms,cstack=vmx", outputCallback); |