JASSv2
JASS_anytime_stats.h
Go to the documentation of this file.
1 /*
2  JASS_ANYTIME_STATS.H
3  --------------------
4  Copyright (c) 2017 Andrew Trotman
5  Released under the 2-clause BSD license (See:https://en.wikipedia.org/wiki/BSD_licenses)
6 */
13 #pragma once
14 
15 /*
16  CLASS JASS_ANYTIME_STATS
17  ------------------------
18 */
23  {
24  public:
25  size_t threads;
28  size_t wall_time_in_ns;
31 
32  public:
33  /*
34  JASS_ANYTIME_STATS::JASS_ANYTIME_STATS()
35  ----------------------------------------
36  */
41  threads(0),
42  number_of_documents(0),
43  number_of_queries(0),
44  wall_time_in_ns(0),
45  sum_of_CPU_time_in_ns(0),
46  total_run_time_in_ns(0)
47  {
48  /* Nothing */
49  }
50  };
51 
52 /*
53  JASS_ANYTIME_STATS::OPERATOR<<()
54  --------------------------------
55 */
62 static inline std::ostream &operator<<(std::ostream &output, JASS_anytime_stats &data)
63  {
64  output << "-------------------\n";
65  output << "Threads : " << data.threads << '\n';
66  output << "Queries : " << data.number_of_queries << '\n';
67  output << "Documents : " << data.number_of_documents << '\n';
68  output << "Total wall time for all queries (main loop time) : " << data.wall_time_in_ns << " ns\n";
69  output << "Total CPU wall time searching (sum of threads) : " << data.sum_of_CPU_time_in_ns << " ns\n";
70  output << "Total time excluding I/O (per query) : " << data.sum_of_CPU_time_in_ns / ((data.number_of_queries == 0) ? 1 : data.number_of_queries) << " ns\n";
71  output << "Total wall clock run time (inc I/O and search) : " << data.total_run_time_in_ns << " ns\n";
72  output << "-------------------\n";
73  return output;
74  }
Runtime statistics for the anytime search engine.
Definition: JASS_anytime_stats.h:22
size_t threads
The number of threads (mean queries per thread = number_of_queries/threads)
Definition: JASS_anytime_stats.h:25
size_t number_of_documents
The number of documents in the collection.
Definition: JASS_anytime_stats.h:26
size_t number_of_queries
The number of queries that have been processed.
Definition: JASS_anytime_stats.h:27
size_t sum_of_CPU_time_in_ns
Sum of the indivivual thread total timers (multi-threaded can be larger than wall_time_in_ns) ...
Definition: JASS_anytime_stats.h:29
size_t total_run_time_in_ns
includes I/O and everything (start main() to end of main()).
Definition: JASS_anytime_stats.h:30
size_t wall_time_in_ns
Total wall time to do all the search (in nanoseconds)
Definition: JASS_anytime_stats.h:28
JASS_anytime_stats()
Constructor.
Definition: JASS_anytime_stats.h:40
static std::ostream & operator<<(std::ostream &output, JASS_anytime_stats &data)
Dump a human readable version of the data down an output stream.
Definition: JASS_anytime_stats.h:62