summaryrefslogtreecommitdiff
path: root/src/pmdas/hotproc/fixpmns.awk
diff options
context:
space:
mode:
Diffstat (limited to 'src/pmdas/hotproc/fixpmns.awk')
-rw-r--r--src/pmdas/hotproc/fixpmns.awk35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pmdas/hotproc/fixpmns.awk b/src/pmdas/hotproc/fixpmns.awk
new file mode 100644
index 0000000..bf2d568
--- /dev/null
+++ b/src/pmdas/hotproc/fixpmns.awk
@@ -0,0 +1,35 @@
+# states
+# 0 nothing interesting is happening, looking for proc { ... }
+# 1 inside proc { ... }; want to copy all lines except
+# "nprocs" metric that does not come from here for the
+# hotproc PMDA
+# 2 looking for proc.foo { ... }
+# 3 inside proc.foo { ... }; want to copy all lines
+#
+BEGIN { print "/*"
+ print " * Hotproc Performance Metric Domain (PMD) Identifiers"
+ print " * (generated from pmns for hotproc and proc metrics)"
+ print " */"
+ print ""
+ print "hotproc {"
+ print " nprocs HOTPROC:100:0"
+ print " cpuburn HOTPROC:102:0"
+ print " total"
+ print " predicate"
+ print " control"
+ state = 0
+ }
+
+state == 0 && /^proc / { state = 1; next }
+
+state == 1 && /nprocs/ { next }
+
+state == 1 && /^}/ { print; print ""; state = 2; next }
+
+state == 1 { print }
+
+state == 2 && /^proc\./ { state = 3 }
+
+state == 3 && /^}/ { print; print ""; state = 2; next }
+
+state == 3 { print }