use new num_open_kprobes() function
diff --git a/tools/funccount b/tools/funccount
index 981d32c..6689872 100755
--- a/tools/funccount
+++ b/tools/funccount
@@ -81,9 +81,14 @@
print(bpf_text)
b = BPF(text=bpf_text)
b.attach_kprobe(event_re=pattern, fn_name="trace_count")
+matched = b.num_open_kprobes()
+if matched == 0:
+ print("0 functions matched by \"%s\". Exiting." % args.pattern)
+ exit()
# header
-print("Tracing... Ctrl-C to end.")
+print("Tracing %d functions for \"%s\"... Hit Ctrl-C to end." %
+ (matched, args.pattern))
# output
exiting = 0 if args.interval else 1