#include <FileStatsTarget.h>
Inheritance diagram for FileStatsTarget:

Public Member Functions | |
| FileStatsTarget (std::string filename) | |
| Creates a new FileStatsTarget. | |
| std::string | getFilename () const |
| Gets name of file receiving stats. | |
| virtual void | beginSnapshot () |
| Begins recording a snapshot. | |
| virtual void | endSnapshot () |
| Finishes recording a snapshot. | |
| virtual void | writeCounter (std::string name, int64_t value) |
| Writes one int counter. | |
| virtual void | onThreadStart () |
| Receives notification that stats polling is starting via a TimerThread. | |
| virtual void | onThreadEnd () |
| Receives notification that stats polling via a TimerThread is ending. | |
Private Attributes | |
| std::string | filename |
| std::ofstream | snapshotStream |
Definition at line 37 of file FileStatsTarget.h.
| FileStatsTarget::FileStatsTarget | ( | std::string | filename | ) | [explicit] |
Creates a new FileStatsTarget.
| filename | name of file into which to write stats |
Definition at line 30 of file FileStatsTarget.cpp.
References filename.
00031 { 00032 filename = filenameInit; 00033 }
| std::string FileStatsTarget::getFilename | ( | ) | const |
Gets name of file receiving stats.
Definition at line 35 of file FileStatsTarget.cpp.
References filename.
00036 { 00037 return filename; 00038 }
| void FileStatsTarget::beginSnapshot | ( | ) | [virtual] |
Begins recording a snapshot.
Called before all writeCounter invocations for the snapshot.
Implements StatsTarget.
Definition at line 40 of file FileStatsTarget.cpp.
References filename, and snapshotStream.
00041 { 00042 assert(!filename.empty()); 00043 snapshotStream.open(filename.c_str(),std::ios::trunc); 00044 00045 // TODO: re-enable this. I disabled it since /tmp/fennel.stats 00046 // can't be opened on mingw; need to parameterize it better 00047 // (or put in Performance Monitor integration) 00048 00049 // assert(snapshotStream.good()); 00050 }
| void FileStatsTarget::endSnapshot | ( | ) | [virtual] |
Finishes recording a snapshot.
Called after all writeCounter invocations for the snapshot.
Implements StatsTarget.
Definition at line 52 of file FileStatsTarget.cpp.
References snapshotStream.
00053 { 00054 snapshotStream.close(); 00055 }
| void FileStatsTarget::writeCounter | ( | std::string | name, | |
| int64_t | value | |||
| ) | [virtual] |
Writes one int counter.
This is called from a StatsSource implementation in response to writeStats().
| name | name of counter | |
| value | snapshot value |
Implements StatsTarget.
Definition at line 57 of file FileStatsTarget.cpp.
References snapshotStream.
00058 { 00059 snapshotStream << name << ' ' << value << std::endl; 00060 }
| void StatsTarget::onThreadStart | ( | ) | [virtual, inherited] |
Receives notification that stats polling is starting via a TimerThread.
Reimplemented in JavaTraceTarget.
Definition at line 111 of file StatsTimer.cpp.
Referenced by StatsTimer::onThreadStart().
| void StatsTarget::onThreadEnd | ( | ) | [virtual, inherited] |
Receives notification that stats polling via a TimerThread is ending.
Reimplemented in JavaTraceTarget.
Definition at line 116 of file StatsTimer.cpp.
Referenced by StatsTimer::onThreadEnd().
std::string FileStatsTarget::filename [private] |
Definition at line 39 of file FileStatsTarget.h.
Referenced by beginSnapshot(), FileStatsTarget(), and getFilename().
std::ofstream FileStatsTarget::snapshotStream [private] |
Definition at line 40 of file FileStatsTarget.h.
Referenced by beginSnapshot(), endSnapshot(), and writeCounter().
1.5.1