[libc-commits] [libc] [libc] NVPTX Profiling Draft (PR #92009)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue May 14 08:58:58 PDT 2024


================
@@ -0,0 +1,70 @@
+#include "LibcGpuBenchmark.h"
+
+namespace LIBC_NAMESPACE {
+namespace libc_gpu_benchmarks {
+
+Benchmark *Benchmark::Start = nullptr;
+Benchmark *Benchmark::End = nullptr;
+
+void Benchmark::addBenchmark(Benchmark *B) {
+  if (End == nullptr) {
+    Start = B;
+    End = B;
+    return;
+  }
+
+  End->Next = B;
+  End = B;
+}
+
+int Benchmark::runBenchmarks() {
+  for (Benchmark *B = Start; B != nullptr; B = B->Next) {
+    B->Run();
+  }
+
----------------
jhuber6 wrote:

```suggestion
  for (Benchmark *B = Start; B != nullptr; B = B->Next)
    B->Run();
```

https://github.com/llvm/llvm-project/pull/92009


More information about the libc-commits mailing list