| 6 | #include "../Core/source/pmon/RawFrameDataMetricList.h" |
| 7 | |
| 8 | int MetricListSample(std::unique_ptr<pmapi::Session> pSession) |
| 9 | { |
| 10 | namespace rn = std::ranges; |
| 11 | namespace vi = rn::views; |
| 12 | auto& session = *pSession; |
| 13 | |
| 14 | std::ofstream out{ "metrics.md" }; |
| 15 | |
| 16 | // header |
| 17 | out << "| Metric | CSV Column | Description | Compatible Query Types |\n" |
| 18 | << "| - | - | - |:-:|\n"; |
| 19 | |
| 20 | // get list of metrics used in CSV (as vector of query element definitions) |
| 21 | const auto csvElements = p2c::pmon::GetDefaultRawFrameDataMetricList(0, false); |
| 22 | |
| 23 | // Loop through ALL PresentMon metrics |
| 24 | for (auto metric : session.GetIntrospectionRoot()->GetMetrics()) { |
| 25 | // get CSV column name if this metric is used in CSV capture file |
| 26 | std::string csvColumnName; |
| 27 | if (rn::contains(csvElements, metric.GetId(), &p2c::pmon::RawFrameQueryElementDefinition::metricId)) { |
| 28 | csvColumnName = metric.Introspect().GetName() |
| 29 | | vi::filter([](char c) { return c != ' '; }) |
| 30 | | rn::to<std::basic_string>(); |
| 31 | } |
| 32 | // name and description |
| 33 | out << std::format("|{}|{}|{}|", |
| 34 | metric.Introspect().GetName(), |
| 35 | csvColumnName, |
| 36 | metric.Introspect().GetDescription() |
| 37 | ); |
| 38 | // query compatibility codes |
| 39 | switch (metric.GetType()) { |
| 40 | case PM_METRIC_TYPE_DYNAMIC: out << "D|\n"; break; |
| 41 | case PM_METRIC_TYPE_DYNAMIC_FRAME: out << "DF|\n"; break; |
| 42 | case PM_METRIC_TYPE_FRAME_EVENT: out << "F|\n"; break; |
| 43 | case PM_METRIC_TYPE_STATIC: out << "DS|\n"; break; |
| 44 | default: out << "|\n"; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // footer |
| 49 | out << "*Query Type Codes: **D** = Dynamic Query, **F** = Frame Event Query, **S** = Static Query\n"; |
| 50 | |
| 51 | return 0; |
| 52 | } |
no test coverage detected