#include "shared_mem_statistics.h"
Public Member Functions | |
int64 | Get64 () const |
virtual int | Get () const |
virtual void | Set (int newValue) |
virtual void | Add (int delta) |
Friends | |
class | SharedMemTimedVariable |
class | SharedMemStatistics |
An implementation of Statistics using our shared memory infrastructure. These statistics will be shared amongst all processes and threads spawned by our host. Note that we will be obtaining a per-variable mutex for every read and write to these variables. Since this may be expensive, we may need each thread to keep a local cache and infrequently write through to this Statistics object.
Because we must allocate shared memory segments and mutexes before any child processes and threads are created, all AddVariable calls must be done in the host before it starts forking/threading. Once all variables are added, you must call InitVariables(true), and then InitVariables(false) in every kid.
If a variable fails to initialize (due to either its mutex or the shared memory segment not working), it will not increment in that process (and a warning message will be logged). If the variable fails to initialize in the process that happens to serve a statistics page, then the variable will show up with value -1.
virtual int net_instaweb::SharedMemVariable::Get | ( | ) | const [virtual] |
Implements net_instaweb::Variable.