Revision: 76436
          http://sourceforge.net/p/brlcad/code/76436
Author:   starseeker
Date:     2020-07-22 22:40:24 +0000 (Wed, 22 Jul 2020)
Log Message:
-----------
Add a timer for the libged's ged_exec, enabled with the GED_EXEC_TIME 
environment variable.

Modified Paths:
--------------
    brlcad/branches/gedplugins/src/libged/exec.cpp

Modified: brlcad/branches/gedplugins/src/libged/exec.cpp
===================================================================
--- brlcad/branches/gedplugins/src/libged/exec.cpp      2020-07-22 22:31:25 UTC 
(rev 76435)
+++ brlcad/branches/gedplugins/src/libged/exec.cpp      2020-07-22 22:40:24 UTC 
(rev 76436)
@@ -28,6 +28,7 @@
 #include <map>
 #include <string>
 
+#include "bu/time.h"
 #include "ged.h"
 #include "./include/plugin.h"
 
@@ -37,6 +38,12 @@
        return GED_ERROR;
     }
 
+    double start;
+    const char *tstr = getenv("GED_EXEC_TIME");
+    if (tstr) {
+       start = bu_gettime();
+    }
+
     // TODO - right now this is the map from the libged load - should probably
     // use this to initialize a struct ged copy when ged_init is called, so
     // client codes can add their own commands to their gedp...
@@ -59,6 +66,10 @@
 
     int cret = (*cmd->i->cmd)(gedp, argc, argv);
 
+    if (tstr) {
+       bu_log("%s time: %g\n", argv[0], (bu_gettime() - start)/1e6);
+    }
+
     // TODO - for the moment these are the hardcoded default opts.  Eventually
     // an opts var should be added to struct ged, and each exec call will set
     // the gedp->opts value to the command defaults.  Then the command option 
handling

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to