MCPcopy Create free account
hub / github.com/Kitware/CMake / StartEntry

Method StartEntry

Source/cmMakefileProfilingData.cxx:45–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void cmMakefileProfilingData::StartEntry(std::string const& category,
46 std::string const& name,
47 cm::optional<Json::Value> args)
48{
49 /* Do not try again if we previously failed to write to output. */
50 if (!this->ProfileStream.good()) {
51 return;
52 }
53
54 try {
55 if (this->ProfileStream.tellp() > 1) {
56 this->ProfileStream << ",";
57 }
58 cmsys::SystemInformation info;
59 Json::Value v;
60 v["ph"] = "B";
61 v["name"] = name;
62 v["cat"] = category;
63 v["ts"] = static_cast<Json::Value::UInt64>(
64 std::chrono::duration_cast<std::chrono::microseconds>(
65 std::chrono::steady_clock::now().time_since_epoch())
66 .count());
67 v["pid"] = static_cast<int>(info.GetProcessId());
68 v["tid"] = 0;
69 if (args) {
70 v["args"] = *std::move(args);
71 }
72
73 this->JsonWriter->write(v, &this->ProfileStream);
74 } catch (std::ios_base::failure& fail) {
75 cmSystemTools::Error(
76 cmStrCat("Failed to write to profiling output: ", fail.what()));
77 } catch (...) {
78 cmSystemTools::Error("Error writing profiling output!");
79 }
80}
81
82void cmMakefileProfilingData::StopEntry()
83{

Callers 1

RAIIMethod · 0.80

Calls 8

moveFunction · 0.85
goodMethod · 0.80
GetProcessIdMethod · 0.80
ErrorClass · 0.70
cmStrCatFunction · 0.70
countMethod · 0.45
writeMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected