~TimingOperationBlock() {
    TimeRecord TEnd = TimeRecord::getCurrentTime(false);
    double elapsed = TEnd.getWallTime() - TStart.getWallTime();
    outs() << format("%.3lf", elapsed) << " sec";

    if (InputSize != 0) {
      double MBPerSec = (InputSize / elapsed) / 1000000.0;
      outs() << format(" [%.3lf MB/sec]", MBPerSec);
    }
    outs() << "\n";
  }
Beispiel #2
0
void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
  if (Total.getUserTime())
    printVal(getUserTime(), Total.getUserTime(), OS);
  if (Total.getSystemTime())
    printVal(getSystemTime(), Total.getSystemTime(), OS);
  if (Total.getProcessTime())
    printVal(getProcessTime(), Total.getProcessTime(), OS);
  printVal(getWallTime(), Total.getWallTime(), OS);
  
  OS << "  ";
  
  if (Total.getMemUsed())
    OS << format("%9" PRId64 "  ", (int64_t)getMemUsed());
}
Beispiel #3
0
void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
  // Sort the timers in descending order by amount of time taken.
  std::sort(TimersToPrint.begin(), TimersToPrint.end());
  
  TimeRecord Total;
  for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i)
    Total += TimersToPrint[i].first;
  
  // Print out timing header.
  OS << "===" << std::string(73, '-') << "===\n";
  // Figure out how many spaces to indent TimerGroup name.
  unsigned Padding = (80-Name.length())/2;
  if (Padding > 80) Padding = 0;         // Don't allow "negative" numbers
  OS.indent(Padding) << Name << '\n';
  OS << "===" << std::string(73, '-') << "===\n";
  
  // If this is not an collection of ungrouped times, print the total time.
  // Ungrouped timers don't really make sense to add up.  We still print the
  // TOTAL line to make the percentages make sense.
  if (this != DefaultTimerGroup)
    OS << format("  Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
                 Total.getProcessTime(), Total.getWallTime());
  OS << '\n';
  
  if (Total.getUserTime())
    OS << "   ---User Time---";
  if (Total.getSystemTime())
    OS << "   --System Time--";
  if (Total.getProcessTime())
    OS << "   --User+System--";
  OS << "   ---Wall Time---";
  if (Total.getMemUsed())
    OS << "  ---Mem---";
  OS << "  --- Name ---\n";
  
  // Loop through all of the timing data, printing it out.
  for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i) {
    const std::pair<TimeRecord, std::string> &Entry = TimersToPrint[e-i-1];
    Entry.first.print(Total, OS);
    OS << Entry.second << '\n';
  }
  
  Total.print(Total, OS);
  OS << "Total\n\n";
  OS.flush();
  
  TimersToPrint.clear();
}
Beispiel #4
0
void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
  // Sort the timers in descending order by amount of time taken.
  llvm::sort(TimersToPrint);

  TimeRecord Total;
  for (const PrintRecord &Record : TimersToPrint)
    Total += Record.Time;

  // Print out timing header.
  OS << "===" << std::string(73, '-') << "===\n";
  // Figure out how many spaces to indent TimerGroup name.
  unsigned Padding = (80-Description.length())/2;
  if (Padding > 80) Padding = 0;         // Don't allow "negative" numbers
  OS.indent(Padding) << Description << '\n';
  OS << "===" << std::string(73, '-') << "===\n";

  // If this is not an collection of ungrouped times, print the total time.
  // Ungrouped timers don't really make sense to add up.  We still print the
  // TOTAL line to make the percentages make sense.
  if (this != getDefaultTimerGroup())
    OS << format("  Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
                 Total.getProcessTime(), Total.getWallTime());
  OS << '\n';

  if (Total.getUserTime())
    OS << "   ---User Time---";
  if (Total.getSystemTime())
    OS << "   --System Time--";
  if (Total.getProcessTime())
    OS << "   --User+System--";
  OS << "   ---Wall Time---";
  if (Total.getMemUsed())
    OS << "  ---Mem---";
  OS << "  --- Name ---\n";

  // Loop through all of the timing data, printing it out.
  for (const PrintRecord &Record : make_range(TimersToPrint.rbegin(),
                                              TimersToPrint.rend())) {
    Record.Time.print(Total, OS);
    OS << Record.Description << '\n';
  }

  Total.print(Total, OS);
  OS << "Total\n\n";
  OS.flush();

  TimersToPrint.clear();
}
Beispiel #5
0
void TM_timeLabelsTelemetry(){
  
    char labels[5][LABEL_LENGTH];
    String labels_str[5] = {tLoop.TIME_getLabel(),
                            tTelemetry.TIME_getLabel(),
                            tConnected.TIME_getLabel(),
                            tAvailable.TIME_getLabel(),
                            tInfoRead.TIME_getLabel()};

    for( int i=0 ; i<LABEL_LENGTH ; i++ )
        for( int j=0 ; j<5 ; j++ )
            if( i < labels_str[0].length() ) labels[j][i] = labels_str[j][i];
            else labels[j][i] = 0;

    uint8_t header[3] = {sizeof(labels[0]), sizeof(labels)/sizeof(labels[0]), TEL_TIMELABELS};
    COMM_write( header, 3 );
    COMM_write( (uint8_t*)labels[0], header[0] );
    COMM_write( (uint8_t*)labels[1], header[0] );
    COMM_write( (uint8_t*)labels[2], header[0] );
    COMM_write( (uint8_t*)labels[3], header[0] );
    COMM_write( (uint8_t*)labels[4], header[0] );
  
}
Beispiel #6
0
void DispatchTask::handle() {
  if(ninfo_->GetInstantTargets().empty() && ninfo_->GetWebpagerTargets().empty()){
    MCE_INFO("DispatchTask::handle. target empty. nid:" << ninfo_->nid_ << " from:" << ninfo_->from_uid_);
    return;
  }

  TimeRecord tc;
  TimeStat st;
  NotifyContentPtr content = InitContent();
  if (!content) {
    MCE_WARN("DispatchTask::handle. init content error. nid:" << ninfo_->nid_ );
    return;
  }
  if (ninfo_->ShouldStore()) {
    ToIndexAndContent(content);
  }
  tc.idxcnt = st.getTime();
  ToNotifyGate(content);
  tc.gate = st.getTime();
  MCE_INFO("DispatchTask::handle: nid:" << ninfo_->nid_ << " from:" << ninfo_->from_uid_ <<" cost. " << tc.ToString());
}
Beispiel #7
0
void TM_timeTelemetry(){

    unsigned long times[6] = {millis(),
                              tLoop.TIME_getAvgTime(),
                              tTelemetry.TIME_getAvgTime(),
                              tConnected.TIME_getAvgTime(),
                              tAvailable.TIME_getAvgTime(),
                              tInfoRead.TIME_getAvgTime()};
    
    uint8_t header[3] = {sizeof(times[0]), sizeof(times)/sizeof(times[0]), TEL_TIMES};
    COMM_write( header, 3 );
    COMM_write( (uint8_t*)&times[0], header[0] );
    COMM_write( (uint8_t*)&times[1], header[0] );
    COMM_write( (uint8_t*)&times[2], header[0] );
    COMM_write( (uint8_t*)&times[3], header[0] );
    COMM_write( (uint8_t*)&times[4], header[0] );
    COMM_write( (uint8_t*)&times[5], header[0] );

    // Reset the records
    tLoop.TIME_resetMaxTRec();
    tInfoRead.TIME_resetMaxTRec();
    tTelemetry.TIME_resetMaxTRec();
}
static void printProfileData(const ProfileData &Profile,
                             llvm::raw_ostream &OS) {
  // Time is first to allow for sorting by it.
  std::vector<std::pair<llvm::TimeRecord, StringRef>> Timers;
  TimeRecord Total;

  for (const auto& P : Profile.Records) {
    Timers.emplace_back(P.getValue(), P.getKey());
    Total += P.getValue();
  }

  std::sort(Timers.begin(), Timers.end());

  std::string Line = "===" + std::string(73, '-') + "===\n";
  OS << Line;

  if (Total.getUserTime())
    OS << "   ---User Time---";
  if (Total.getSystemTime())
    OS << "   --System Time--";
  if (Total.getProcessTime())
    OS << "   --User+System--";
  OS << "   ---Wall Time---";
  if (Total.getMemUsed())
    OS << "  ---Mem---";
  OS << "  --- Name ---\n";

  // Loop through all of the timing data, printing it out.
  for (auto I = Timers.rbegin(), E = Timers.rend(); I != E; ++I) {
    I->first.print(Total, OS);
    OS << I->second << '\n';
  }

  Total.print(Total, OS);
  OS << "Total\n";
  OS << Line << "\n";
  OS.flush();
}