| 24 | } |
| 25 | |
| 26 | DLLEXPORT asprof_error_t asprof_execute(const char* command, asprof_writer_t output_callback) { |
| 27 | Arguments args; |
| 28 | Error error = args.parse(command); |
| 29 | if (error) { |
| 30 | return asprof_error(error.message()); |
| 31 | } |
| 32 | |
| 33 | Log::open(args); |
| 34 | |
| 35 | if (!args.hasOutputFile()) { |
| 36 | CallbackWriter out(output_callback); |
| 37 | error = Profiler::instance()->runInternal(args, out); |
| 38 | if (!error) { |
| 39 | return NULL; |
| 40 | } |
| 41 | } else { |
| 42 | FileWriter out(args.file()); |
| 43 | if (!out.is_open()) { |
| 44 | return asprof_error("Could not open output file"); |
| 45 | } |
| 46 | error = Profiler::instance()->runInternal(args, out); |
| 47 | if (!error) { |
| 48 | return NULL; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return asprof_error(error.message()); |
| 53 | } |
| 54 | |
| 55 | DLLEXPORT asprof_thread_local_data* asprof_get_thread_local_data(void) { |
| 56 | return ThreadLocalData::getThreadLocalData(); |
nothing calls this directly
no test coverage detected