net_instaweb::SharedMemVariable Class Reference

#include "shared_mem_statistics.h"

Inheritance diagram for net_instaweb::SharedMemVariable:
net_instaweb::Variable

List of all members.

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

Detailed Description

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.

Todo:
TODO(abliss): actually do this.

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.


Member Function Documentation

virtual int net_instaweb::SharedMemVariable::Get (  )  const [virtual]
Todo:
TODO(sligocki): int -> int64

Implements net_instaweb::Variable.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:17 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3