| 104 | |
| 105 | |
| 106 | Future<http::Response> Profiler::stop( |
| 107 | const http::Request& request, |
| 108 | const Option<http::authentication::Principal>&) |
| 109 | { |
| 110 | #ifdef ENABLE_GPERFTOOLS |
| 111 | if (!started) { |
| 112 | return http::BadRequest("Profiler not running.\n"); |
| 113 | } |
| 114 | |
| 115 | LOG(INFO) << "Stopping Profiler"; |
| 116 | |
| 117 | ProfilerStop(); |
| 118 | |
| 119 | http::OK response; |
| 120 | response.type = response.PATH; |
| 121 | response.path = "perftools.out"; |
| 122 | response.headers["Content-Type"] = "application/octet-stream"; |
| 123 | response.headers["Content-Disposition"] = |
| 124 | strings::format("attachment; filename=%s", PROFILE_FILE).get(); |
| 125 | |
| 126 | started = false; |
| 127 | return response; |
| 128 | #else |
| 129 | return http::BadRequest( |
| 130 | "Perftools is disabled. To enable perftools, " |
| 131 | "configure libprocess with --enable-perftools.\n"); |
| 132 | #endif |
| 133 | } |
| 134 | |
| 135 | } // namespace process { |
nothing calls this directly
no test coverage detected