traced_perf: enable SMB scraping + cts improvements

Scraping to help with timeouts on StopDataSource (as the producer
doesn't ack the stop until all of the internal buffers for that source
have been processed), which appears to be quite common on some test
targets (at least the gphone emu). Scraping shouldn't hurt outside
of tests either.

Fix an oversight in the cts test where it wasn't being skipped for older
kernels.

Otherwise, tweak timeouts and add a bit more logging on failures to see
whether cuttflefish is just slow, or there's an actual problem.

Change-Id: I862e82deee1f790afea942dacc767229e980e317
Bug: 149895879
diff --git a/test/cts/utils.cc b/test/cts/utils.cc
index c61eff7..79e5d4d 100644
--- a/test/cts/utils.cc
+++ b/test/cts/utils.cc
@@ -54,7 +54,7 @@
 
 // note: cannot use gtest macros due to return type
 bool IsAppRunning(const std::string& name) {
-  std::string cmd = "pgrep -f " + name;
+  std::string cmd = "pgrep -f ^" + name + "$";
   int retcode = system(cmd.c_str());
   PERFETTO_CHECK(retcode >= 0);
   int exit_status = WEXITSTATUS(retcode);
@@ -66,9 +66,7 @@
 }
 
 int PidForProcessName(const std::string& name) {
-  // quirk: need to exclude ourselves from the result as the pgrep's cmdline
-  // matches itself when invoked via popen.
-  std::string cmd = "pgrep -f " + name + " | grep -v $$";
+  std::string cmd = "pgrep -f ^" + name + "$";
   FILE* fp = popen(cmd.c_str(), "re");
   if (!fp)
     return -1;