Browse Source

pview: Add `-S` flag to connect to pstats right away

rdb 2 years ago
parent
commit
0c4fe35a5c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      panda/src/testbed/pview.cxx

+ 9 - 1
panda/src/testbed/pview.cxx

@@ -355,7 +355,7 @@ main(int argc, char **argv) {
 
   extern char *optarg;
   extern int optind;
-  static const char *optflags = "acls:DVhiLP:";
+  static const char *optflags = "acls:DVhiLP:S";
   int flag = getopt(argc, argv, optflags);
 
   while (flag != EOF) {
@@ -399,6 +399,14 @@ main(int argc, char **argv) {
       break;
     }
 
+    case 'S':
+      if (!PStatClient::connect()) {
+        cerr << "Failed to connect to PStats server." << endl;
+        return 1;
+      }
+      PStatClient::main_tick();
+      break;
+
     case 'V':
       report_version();
       return 1;