File indexing completed on 2026-04-09 07:49:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "STimes.hh"
0021
0022 #include <sstream>
0023 #include <cstring>
0024 #include <cstdio>
0025 #include <iomanip>
0026
0027
0028 std::string STimes::brief(const char* msg)
0029 {
0030 std::stringstream ss ;
0031 ss
0032 << msg
0033 << " vali,comp,prel,lnch "
0034 << std::fixed << std::setw(7) << std::setprecision(4)
0035 << validate
0036 << std::fixed << std::setw(7) << std::setprecision(4)
0037 << compile
0038 << std::fixed << std::setw(7) << std::setprecision(4)
0039 << prelaunch
0040 << std::fixed << std::setw(7) << std::setprecision(4)
0041 << launch
0042 ;
0043 return ss.str();
0044 }
0045
0046
0047 const char* STimes::description(const char* msg)
0048 {
0049 if(count == 0) return 0 ;
0050 char desc[256];
0051 snprintf(desc, 256,
0052 "%s \n"
0053 " count %5u sum \n"
0054 " validate %10.4f %10.4f \n"
0055 " compile %10.4f %10.4f \n"
0056 " prelaunch %10.4f %10.4f \n"
0057 " launch %10.4f %10.4f \n",
0058 msg,
0059 count,
0060 validate, validate/count,
0061 compile , compile/count,
0062 prelaunch, prelaunch/count,
0063 launch, launch/count);
0064
0065 _description = strdup(desc);
0066 return _description ;
0067 }
0068
0069
0070
0071 std::string STimes::desc() const
0072 {
0073 if( count == 0) return "" ;
0074 std::stringstream ss ;
0075 ss
0076 << std::setw(11) << ""
0077 << std::setw(10) << "num"
0078 << std::setw(10) << "sum"
0079 << std::setw(10) << "avg"
0080 << std::endl
0081
0082 << std::setw(11) << "validate"
0083 << std::setw(10) << count
0084 << std::fixed << std::setw(10) << std::setprecision(4) << validate
0085 << std::fixed << std::setw(10) << std::setprecision(4) << validate/count
0086 << std::endl
0087
0088 << std::setw(11) << "compile"
0089 << std::setw(10) << count
0090 << std::fixed << std::setw(10) << std::setprecision(4) << compile
0091 << std::fixed << std::setw(10) << std::setprecision(4) << compile/count
0092 << std::endl
0093
0094 << std::setw(11) << "prelaunch"
0095 << std::setw(10) << count
0096 << std::fixed << std::setw(10) << std::setprecision(4) << prelaunch
0097 << std::fixed << std::setw(10) << std::setprecision(4) << prelaunch/count
0098 << std::endl
0099
0100 << std::setw(11) << "launch"
0101 << std::setw(10) << count
0102 << std::fixed << std::setw(10) << std::setprecision(4) << launch
0103 << std::fixed << std::setw(10) << std::setprecision(4) << launch/count
0104 << std::endl
0105 ;
0106
0107 return ss.str() ;
0108 }
0109