| 80 | } |
| 81 | |
| 82 | void cmMakefileProfilingData::StopEntry() |
| 83 | { |
| 84 | /* Do not try again if we previously failed to write to output. */ |
| 85 | if (!this->ProfileStream.good()) { |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | try { |
| 90 | this->ProfileStream << ","; |
| 91 | cmsys::SystemInformation info; |
| 92 | Json::Value v; |
| 93 | v["ph"] = "E"; |
| 94 | v["ts"] = static_cast<Json::Value::UInt64>( |
| 95 | std::chrono::duration_cast<std::chrono::microseconds>( |
| 96 | std::chrono::steady_clock::now().time_since_epoch()) |
| 97 | .count()); |
| 98 | v["pid"] = static_cast<int>(info.GetProcessId()); |
| 99 | v["tid"] = 0; |
| 100 | this->JsonWriter->write(v, &this->ProfileStream); |
| 101 | } catch (std::ios_base::failure& fail) { |
| 102 | cmSystemTools::Error( |
| 103 | cmStrCat("Failed to write to profiling output:", fail.what())); |
| 104 | } catch (...) { |
| 105 | cmSystemTools::Error("Error writing profiling output!"); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | cmMakefileProfilingData::RAII::RAII(cmMakefileProfilingData& data, |
| 110 | std::string const& category, |