Files
rippled/modules/ripple_core/functional/ripple_LoadEvent.h
2013-06-27 07:57:14 -07:00

53 lines
1.4 KiB
C++

//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
#ifndef RIPPLE_LOADEVENT_H
#define RIPPLE_LOADEVENT_H
class LoadMonitor;
// VFALCO NOTE What is the difference between a LoadEvent and a LoadMonitor?
// VFALCO TODO Rename LoadEvent to ScopedLoadSample
//
// This looks like a scoped elapsed time measuring class
//
class LoadEvent
{
public:
// VFALCO NOTE Why are these shared pointers? Wouldn't there be a
// piece of lifetime-managed calling code that can simply own
// the object?
//
// Why both kinds of containers?
//
typedef boost::shared_ptr <LoadEvent> pointer;
typedef UPTR_T <LoadEvent> autoptr;
public:
// VFALCO TODO remove the dependency on LoadMonitor. Is that possible?
LoadEvent (LoadMonitor& monitor,
const std::string& name,
bool shouldStart);
~LoadEvent ();
// VFALCO TODO rename this to setName () or setLabel ()
void reName (const std::string& name);
// okay to call if already started
void start ();
void stop ();
private:
LoadMonitor& mMonitor;
bool mRunning;
std::string mName;
boost::posix_time::ptime mStartTime;
};
#endif