OnlineTimingStats Class Reference

class OnlineTimingStats stores statistics from timing of online decoding, which will enable the Print() function to print out the average real-time factor and average delay per utterance. More...

#include <online-timing.h>

Collaboration diagram for OnlineTimingStats:

Public Member Functions

 OnlineTimingStats ()
 
void Print (bool online=true)
 Here, if "online == false" we take into account that the setup was used in not-really-online mode where the chunk length was the whole file. More...
 

Protected Attributes

int32 num_utts_
 
double total_audio_
 
double total_time_taken_
 
double total_time_waited_
 
double max_delay_
 
std::string max_delay_utt_
 

Friends

class OnlineTimer
 

Detailed Description

class OnlineTimingStats stores statistics from timing of online decoding, which will enable the Print() function to print out the average real-time factor and average delay per utterance.

See class OnlineTimer.

Definition at line 41 of file online-timing.h.

Constructor & Destructor Documentation

◆ OnlineTimingStats()

Member Function Documentation

◆ Print()

void Print ( bool  online = true)

Here, if "online == false" we take into account that the setup was used in not-really-online mode where the chunk length was the whole file.

We need to change the way we interpret the stats and print results, in this case.

Definition at line 29 of file online-timing.cc.

References KALDI_LOG, OnlineTimingStats::max_delay_, OnlineTimingStats::max_delay_utt_, OnlineTimingStats::num_utts_, OnlineTimingStats::total_audio_, OnlineTimingStats::total_time_taken_, and OnlineTimingStats::total_time_waited_.

Referenced by main().

29  {
30  if (online) {
31  double real_time_factor = total_time_taken_ / total_audio_,
32  average_wait = (total_time_taken_ - total_audio_) / num_utts_,
33  idle_proportion = total_time_waited_ / total_audio_,
34  idle_percent = 100.0 * idle_proportion;
35 
36  KALDI_LOG << "Timing stats: real-time factor was " << real_time_factor
37  << " (note: this cannot be less than one.)";
38  KALDI_LOG << "Average delay was " << average_wait << " seconds.";
39  if (idle_percent != 0.0) {
40  // If the user was calling SleepUntil instead of WaitUntil, this will
41  // always be zero; so don't print it in that case.
42  KALDI_LOG << "Percentage of time spent idling was " << idle_percent;
43  }
44  KALDI_LOG << "Longest delay was " << max_delay_ << " seconds for utterance "
45  << '\'' << max_delay_utt_ << '\'';
46  } else {
47  // we have processed each utterance in one chunk.
48  // the decoding code will have "pretended to wait" (using WaitUntil())
49  // till the end of the utterance before starting to decode it.
50  // We want to subtract this waiting time, which is not really
51  // of interest in an offline scenario, before printing the
52  // real-time factor.
53  double real_time_factor = (total_time_taken_ - total_time_waited_) /
55  KALDI_LOG << "Timing stats: real-time factor for offline decoding was "
56  << real_time_factor << " = "
57  << (total_time_taken_ - total_time_waited_) << " seconds "
58  << " / " << total_audio_ << " seconds.";
59  }
60 }
#define KALDI_LOG
Definition: kaldi-error.h:153

Friends And Related Function Documentation

◆ OnlineTimer

friend class OnlineTimer
friend

Definition at line 49 of file online-timing.h.

Member Data Documentation

◆ max_delay_

double max_delay_
protected

Definition at line 57 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().

◆ max_delay_utt_

std::string max_delay_utt_
protected

Definition at line 58 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().

◆ num_utts_

int32 num_utts_
protected

Definition at line 50 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().

◆ total_audio_

double total_audio_
protected

Definition at line 52 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().

◆ total_time_taken_

double total_time_taken_
protected

Definition at line 53 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().

◆ total_time_waited_

double total_time_waited_
protected

Definition at line 54 of file online-timing.h.

Referenced by OnlineTimer::OutputStats(), and OnlineTimingStats::Print().


The documentation for this class was generated from the following files: