56 void ProcessLine(
const char* line,
const string& file_ext);
63 bool is_header =
false);
73 virtual void Init(
void);
74 virtual int Run(
void);
87 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
88 "Compose summary of 'check.sh.log' files");
94 (
"nocolor",
"Do not use JIRA colors");
100 "Files to process: list of extensions (as in 'perf_view.EXT')",
120 for (
size_t extra = 1; extra <= args.
GetNExtra(); extra++) {
133 ifstream
file(
"perf_view." + file_ext);
135 throw runtime_error(
"Error opening file perf_view." + file_ext);
137 while (
file.good() ) {
140 file.getline(line,
sizeof(line));
146 throw runtime_error(
"Error reading file perf_view." + file_ext);
178 string ids = re.
Extract(
"[^ ]*$");
184 string threads = re.
Extract(
"[^ ]*$");
185 if ( threads.empty() )
193 if (loader ==
"gb") {
198 }
else if (loader ==
"psg") {
216 string bulk = re.
Extract(
"[^ ]*$");
217 if (bulk ==
"bioseq")
219 else if (bulk ==
"data")
224 name = ids +
"/" + threads +
"/" +
split;
226 name = name +
"," + bulk;
243 string xtime = re.
Extract(
"[^ ]*$");
247 os << setprecision(dtime < 100.0 ? 2 : 3) << dtime;
252 m_Results[file_ext][loader][name] = stime;
265 static size_t color_counter = 0;
266 static const vector<string> kColors =
267 {
"black",
"red",
"blue",
"green",
268 "orange",
"pink",
"brown",
"purple" };
270 m_Colors[
color] = kColors[color_counter++ % kColors.size()];
276 string x_value =
value;
278 && x_value.find_first_not_of(
"0123456789. *") != string::npos)
279 x_value =
"*" + x_value +
"*";
281 return "{color:" + m_Colors[
color] +
"}" + x_value +
"{color}";
291 CXYZ = client "C" against server + "PSG-X.Y.Z"
293 * 'T' - contemporary TRUNK
294 * 'S' - latest SC in SVN
295 * 'P' - contemporary full production build
296 * 'O' - previous full production build
301 {{{color:blue}*C*{color}{color:red}*XYZ*{color}}} = client {color:blue}{{*C*}}{color} against server + {{PSG-{color:red}*X.Y.Z*{color}}}, _where_ {color:blue}{{*C*}}{color}:
302 * '{color:blue}{{T}}{color}' - contemporary TRUNK
303 * '{color:blue}{{S}}{color}' - latest SC in SVN
304 * '{color:blue}{{P}}{color}' - contemporary full production build
305 * '{color:blue}{{O}}{color}' - previous full production build
311 For the special case of OBJMGR_PERF_TEST the test name is decomposed and then
312 converted into a shorter form "IDs/Threads/Parameters" -- where:
313 * *IDs*: file of seq-ids
314 * *Thr*: number of threads (if specified)
315 * *Par*: N = No-Split, S = Split; BD = Bulk-Data, BB = Bulk-Bioseq
317 Minimum time/s for each run are highlighted in *bold*.
319 Average time for each run is shown as "= _*avg*_".
324 vector<TType> loaders = { "PSG",
"OSG",
"PSOS",
"UNK" };
328 cout <<
" || Name || ";
330 cout <<
" || IDs/Thr/Par || ";
332 size_t loader_idx = 0;
333 for (
const string& loader : loaders) {
334 if ( ( print_unk && loader !=
"UNK")
335 || (!print_unk && loader ==
"UNK"))
338 bool loader_empty =
true;
340 for (
const auto& x_loader : x_run.second) {
341 if (x_loader.first != loader || x_loader.second.empty())
343 loader_empty =
false;
349 if ( loader_empty ) {
350 loaders[loader_idx].erase();
357 cout <<
"*_" << loader <<
"_*\n";
359 cout <<
ColorMe(run.first, run.first,
true) <<
" ";
367 if ( ( print_unk && !
m_NameAttr[name].has_unknown)
368 || (!print_unk && !
m_NameAttr[name].has_special) )
371 cout <<
" | " << name <<
" | ";
372 for (
const string& loader : loaders) {
373 if ( ( print_unk && loader !=
"UNK")
374 || (!print_unk && loader ==
"UNK"))
377 if ( loader.empty() )
381 string min_stime =
" ";
384 double avg_time = {};
390 if (dtime < min_dtime) {
392 min_stime =
m_Results[run.first][loader][name];
401 bool has_non_abs_values =
false;
407 string& time =
m_Results[run.first][loader][name];
411 has_non_abs_values =
true;
412 if (n_time > 1 && time == min_stime)
413 time =
"*" + time +
"*";
415 ostr <<
ColorMe(time, run.first);
417 if ( has_non_abs_values ) {
419 if (n_time > 1 && avg_time) {
422 ostr << setprecision(avg_time < 100.0 ? 2 : 3) << avg_time;
423 cout <<
" = _*" <<
ColorMe(ostr.str(),
"AVERAGE") <<
"*_";
void ProcessFile(const string &file_ext)
map< TName, TTime > TNameTime
virtual void Init(void)
Initialize the application.
void PrintResult(bool print_unk)
map< TName, SNameAttr > m_NameAttr
virtual int Run(void)
Run the application.
void ProcessLine(const char *line, const string &file_ext)
string ColorMe(const string &value, const TSetup &color, bool is_header=false)
map< TSetup, TRun > TResults
map< TType, TNameTime > TRun
iterator_bool insert(const value_type &val)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
@ eString
An arbitrary string.
string Extract(CTempStringEx pattern, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default, size_t pattern_idx=0)
Get matching pattern/subpattern from string.
void Reset(CTempString str)
Reset the content of the string to process.
static CTempString TruncateSpaces_Unsafe(const CTempString str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
@ fConvErr_NoThrow
Do not throw an exception on error.
constexpr bool empty(list< Ts... >) noexcept
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
void split(std::vector< std::string > *strVec, const std::string &str_, const std::string &split_)
int NcbiSys_main(int argc, ncbi::TXChar *argv[])
static const char * str(char *buf, int n)
C++ wrappers for the Perl-compatible regular expression (PCRE) library.