Add Perl support for ucalls / uflow / ustat (#1959)
Sort language entries while at it.
diff --git a/tools/lib/ustat.py b/tools/lib/ustat.py
index 34cc019..8b2f80f 100755
--- a/tools/lib/ustat.py
+++ b/tools/lib/ustat.py
@@ -5,7 +5,7 @@
# method calls, class loads, garbage collections, and more.
# For Linux, uses BCC, eBPF.
#
-# USAGE: ustat [-l {java,python,ruby,node,php}] [-C]
+# USAGE: ustat [-l {java,node,perl,php,python,ruby}] [-C]
# [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d]
# [interval [count]]
#
@@ -132,7 +132,7 @@
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=examples)
parser.add_argument("-l", "--language",
- choices=["java", "python", "ruby", "node", "php"],
+ choices=["java", "node", "perl", "php", "python", "ruby"],
help="language to trace (default: all languages)")
parser.add_argument("-C", "--noclear", action="store_true",
help="don't clear the screen")
@@ -151,18 +151,30 @@
def _create_probes(self):
probes_by_lang = {
+ "java": Probe("java", ["java"], {
+ "gc__begin": Category.GC,
+ "mem__pool__gc__begin": Category.GC,
+ "thread__start": Category.THREAD,
+ "class__loaded": Category.CLOAD,
+ "object__alloc": Category.OBJNEW,
+ "method__entry": Category.METHOD,
+ "ExceptionOccurred__entry": Category.EXCP
+ }),
"node": Probe("node", ["node"], {
"gc__start": Category.GC
}),
- "python": Probe("python", ["python"], {
- "function__entry": Category.METHOD,
- "gc__start": Category.GC
+ "perl": Probe("perl", ["perl"], {
+ "sub__entry": Category.METHOD
}),
"php": Probe("php", ["php"], {
"function__entry": Category.METHOD,
"compile__file__entry": Category.CLOAD,
"exception__thrown": Category.EXCP
}),
+ "python": Probe("python", ["python"], {
+ "function__entry": Category.METHOD,
+ "gc__start": Category.GC
+ }),
"ruby": Probe("ruby", ["ruby", "irb"], {
"method__entry": Category.METHOD,
"cmethod__entry": Category.METHOD,
@@ -176,15 +188,6 @@
"load__entry": Category.CLOAD,
"raise": Category.EXCP
}),
- "java": Probe("java", ["java"], {
- "gc__begin": Category.GC,
- "mem__pool__gc__begin": Category.GC,
- "thread__start": Category.THREAD,
- "class__loaded": Category.CLOAD,
- "object__alloc": Category.OBJNEW,
- "method__entry": Category.METHOD,
- "ExceptionOccurred__entry": Category.EXCP
- })
}
if self.args.language: