Skip to content

Commit

Permalink
now use CPUTimer instead of TStopwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Apr 19, 2006
1 parent e3c675c commit e16e382
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 26 deletions.
2 changes: 0 additions & 2 deletions FWCore/Framework/BuildFile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<use name=boost>
<use name=rootcore>
<use name=DataFormats/Common>
<use name=FileCatalog>
<use name=FWCore/ParameterSet>
Expand All @@ -9,7 +8,6 @@
<export>
<lib name=FWCoreFramework>
<use name=boost>
<use name=rootcore>
<use name=DataFormats/Common>
<use name=FileCatalog>
<use name=FWCore/ParameterSet>
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/Schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
Author: Jim Kowalkowski 28-01-06
$Id: Schedule.h,v 1.6 2006/04/04 16:55:36 lsexton Exp $
$Id: Schedule.h,v 1.7 2006/04/10 22:35:43 jbk Exp $
A class for creating a schedule based on paths in the configuration file.
The schedule is maintained as a sequence of paths.
Expand Down Expand Up @@ -142,7 +142,7 @@ namespace edm
void endJob();

std::pair<double,double> timeCpuReal() const {
return std::pair<double,double>(stopwatch_->CpuTime(),stopwatch_->RealTime());
return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
}

private:
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Framework/src/Path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace edm
ParameterSet const& proc_pset,
ActionTable& actions,
ActivityRegistryPtr areg):
stopwatch_(new TStopwatch),
stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
timesRun_(),
timesPassed_(),
timesFailed_(),
Expand All @@ -53,7 +53,6 @@ namespace edm
act_table_(&actions),
workers_(workers)
{
stopwatch_->Stop();
}

#if 0
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author: Jim Kowalkowski 28-01-06
$Id: Path.h,v 1.3 2006/02/08 00:44:25 wmtan Exp $
$Id: Path.h,v 1.4 2006/04/04 16:55:37 lsexton Exp $
An object of this type represents one path in a job configuration.
It holds the assigned bit position and the list of workers that are
Expand Down Expand Up @@ -57,7 +57,7 @@ namespace edm
const std::string& name() const { return name_; }

std::pair<double,double> timeCpuReal() const {
return std::pair<double,double>(stopwatch_->CpuTime(),stopwatch_->RealTime());
return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
}

std::pair<double,double> timeCpuReal(const unsigned int i) const {
Expand Down
10 changes: 5 additions & 5 deletions FWCore/Framework/src/RunStopwatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/*----------------------------------------------------------------------
$Id: RunStopwatch.h,v 1.0 2006/02/08 00:44:25 wmtan Exp $
$Id: RunStopwatch.h,v 1.1 2006/04/04 16:55:37 lsexton Exp $
Simple "guard" class as suggested by Chris Jones to start/stop the
Stopwatch: creating an object of type RunStopwatch starts the clock
Expand All @@ -14,21 +14,21 @@ calls the destructor which stops the clock.

#include "boost/shared_ptr.hpp"
#include "boost/scoped_ptr.hpp"
#include "TStopwatch.h"
#include "FWCore/Utilities/interface/CPUTimer.h"

namespace edm {

class RunStopwatch {

public:
typedef boost::shared_ptr<TStopwatch> StopwatchPointer;
typedef boost::shared_ptr<CPUTimer> StopwatchPointer;

RunStopwatch(const StopwatchPointer& ptr): stopwatch_(ptr) {
stopwatch_->Start(false);
stopwatch_->start();
}

~RunStopwatch(){
stopwatch_->Stop();
stopwatch_->stop();
}

private:
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Framework/src/Schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace edm
makeTriggerResults_(tns.makeTriggerResults()),
total_events_(),
total_passed_(),
stopwatch_(new TStopwatch),
stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
unscheduled_(new UnscheduledCallProducer)
{
ParameterSet defopts;
Expand Down Expand Up @@ -270,7 +270,6 @@ namespace edm
}
}

stopwatch_->Stop();
}

void Schedule::handleWronglyPlacedModules()
Expand Down
5 changes: 2 additions & 3 deletions FWCore/Framework/src/Worker.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*----------------------------------------------------------------------
$Id: Worker.cc,v 1.7 2006/02/17 22:09:53 wmtan Exp $
$Id: Worker.cc,v 1.8 2006/04/04 16:55:37 lsexton Exp $
----------------------------------------------------------------------*/

#include <iostream>
Expand Down Expand Up @@ -32,7 +32,7 @@ namespace edm

Worker::Worker(const ModuleDescription& iMD,
const WorkerParams& iWP):
stopwatch_(new TStopwatch),
stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
timesRun_(),
timesVisited_(),
timesPassed_(),
Expand All @@ -43,7 +43,6 @@ namespace edm
actions_(iWP.actions_),
cached_exception_()
{
stopwatch_->Stop();
}

Worker::~Worker()
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/Worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Worker: this is a basic scheduling unit - an abstract base class to
something that is really a producer or filter.
$Id: Worker.h,v 1.9 2006/02/08 00:44:25 wmtan Exp $
$Id: Worker.h,v 1.10 2006/04/04 16:55:37 lsexton Exp $
A worker will not actually call through to the module unless it is
in a Ready state. After a module is actually run, the state will not
Expand Down Expand Up @@ -54,7 +54,7 @@ namespace edm {
void connect(ActivityRegistry::PreModule&, ActivityRegistry::PostModule&);

std::pair<double,double> timeCpuReal() const {
return std::pair<double,double>(stopwatch_->CpuTime(),stopwatch_->RealTime());
return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
}

int timesRun() const { return timesRun_; }
Expand Down
6 changes: 2 additions & 4 deletions FWCore/Framework/src/WorkerInPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,25 @@
namespace edm
{
WorkerInPath::WorkerInPath(Worker* w, State state):
stopwatch_(new TStopwatch),
stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
timesVisited_(),
timesPassed_(),
timesFailed_(),
timesExcept_(),
state_(state),
worker_(w)
{
stopwatch_->Stop();
}

WorkerInPath::WorkerInPath(Worker* w):
stopwatch_(new TStopwatch),
stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
timesVisited_(),
timesPassed_(),
timesFailed_(),
timesExcept_(),
state_(Normal),
worker_(w)
{
stopwatch_->Stop();
}

bool WorkerInPath::runWorker(EventPrincipal& ep, EventSetup const & es)
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/WorkerInPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author: Jim Kowalkowski 28-01-06
$Id: WorkerInPath.h,v 1.2 2006/02/04 04:31:01 jbk Exp $
$Id: WorkerInPath.h,v 1.3 2006/04/04 16:55:37 lsexton Exp $
A wrapper around a Worker, so that statistics can be managed
per path. A Path holds Workers as these things.
Expand All @@ -31,7 +31,7 @@ namespace edm
bool runWorker(EventPrincipal&, EventSetup const&);

std::pair<double,double> timeCpuReal() const {
return std::pair<double,double>(stopwatch_->CpuTime(),stopwatch_->RealTime());
return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
}

int timesVisited() const { return timesVisited_; }
Expand Down

0 comments on commit e16e382

Please sign in to comment.