On Thu, Oct 27, 2016 at 2:10 PM, Christopher Sean Morrison <brl...@mac.com> wrote: > > To move it, we need an api either parallel to or replacing bu_gettime() and > bu_utctime(). > Fortunately, both those names kind of suck, so I’m thinking we just design a > better > replacement api. [snip] The only way I can see keeping any new usage that > simple, > **without introducing a whole other function**, is to have bu_gettime() take > bitflags > and perhaps return an array of int64_t’s (with the bitflags doubling as > indices). Something like this: > > int64_t start[2], stop[2]; > bu_time(&start, sizeof(start), BU_TIME_WALLCLOCK | BU_TIME_CPU); > … > bu_time(&stop, sizeof(stop), BU_TIME_WALLCLOCK); > printf(“elapsed is %lf\n”, stop[BU_TIME_WALLCLOCK] - > start[BU_TIME_WALLCLOCK]); > > There are obviously other options. Anyone have any suggestions? This would > probably > make a great couple GCI tasks… ;)
Hmm. Are you proposing returning an array to allow for the possibility of (essentially) simultaneous setting of wall clock and cpu clock values? I like the idea of passing an argument to the time function to get different types of time, but absent a hard need for simultaneous stamping of wall and cpu clocks my suggestion would be to go really simple: int64_t wall, cpu; wall = bu_time(BU_TIME_WALLCLOCK); cpu = bu_time(BU_TIME_CPU); ... printf(“wallclock elapsed is %lf\n”, bu_time(BU_TIME_WALLCLOCK) - start); printf(“cpu elapsed is %lf\n”, bu_time(BU_TIME_CPU) - start); but I'm less familiar with some of the subtler issues of timing so there may be some aspect of this that is not practical. CY ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ BRL-CAD Developer mailing list brlcad-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-devel