forked from weaselab/conflict-set
ifdef linux specific stuff
This commit is contained in:
+4
-5
@@ -228,11 +228,6 @@ private:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
struct PerfCounter {
|
|
||||||
PerfCounter(int, int) {}
|
|
||||||
int64_t total() { return 0; }
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@@ -247,6 +242,7 @@ int main(int argc, char **argv) {
|
|||||||
int metricsCount;
|
int metricsCount;
|
||||||
cs.getMetricsV1(&metrics, &metricsCount);
|
cs.getMetricsV1(&metrics, &metricsCount);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
PerfCounter instructions{PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS};
|
PerfCounter instructions{PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS};
|
||||||
PerfCounter cycles{PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES, "",
|
PerfCounter cycles{PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES, "",
|
||||||
instructions.getFd()};
|
instructions.getFd()};
|
||||||
@@ -288,6 +284,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
auto w = std::thread{workload, &cs};
|
auto w = std::thread{workload, &cs};
|
||||||
|
|
||||||
@@ -316,6 +313,7 @@ int main(int argc, char **argv) {
|
|||||||
"transactions_total ";
|
"transactions_total ";
|
||||||
body += std::to_string(transactions.load(std::memory_order_relaxed));
|
body += std::to_string(transactions.load(std::memory_order_relaxed));
|
||||||
body += "\n";
|
body += "\n";
|
||||||
|
#ifdef __linux__
|
||||||
body += "# HELP instructions_total Total number of instructions\n"
|
body += "# HELP instructions_total Total number of instructions\n"
|
||||||
"# TYPE instructions_total counter\n"
|
"# TYPE instructions_total counter\n"
|
||||||
"instructions_total ";
|
"instructions_total ";
|
||||||
@@ -332,6 +330,7 @@ int main(int argc, char **argv) {
|
|||||||
body += "cache_event_total" + counter.getLabels() + " " +
|
body += "cache_event_total" + counter.getLabels() + " " +
|
||||||
std::to_string(counter.total()) + "\n";
|
std::to_string(counter.total()) + "\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < metricsCount; ++i) {
|
for (int i = 0; i < metricsCount; ++i) {
|
||||||
body += "# HELP ";
|
body += "# HELP ";
|
||||||
|
|||||||
Reference in New Issue
Block a user