Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Friends
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 Get () const
virtual int64 SetReturningPreviousValue (int64 new_value)
 Atomic.
virtual void Set (int64 new_value)
virtual int64 Add (int delta)
virtual StringPiece GetName () const
AbstractMutexmutex ()

Friends

class SharedMemConsoleStatisticsLogger
class SharedMemStatistics
class SharedMemTimedVariable

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 int64 net_instaweb::SharedMemVariable::Add ( int  delta) [virtual]

Adds 'delta' to the variable's value, returning the result. This is virtual so that subclasses can add platform-specific atomicity.

Reimplemented from net_instaweb::Variable.

virtual StringPiece net_instaweb::SharedMemVariable::GetName ( ) const [inline, virtual]

Return some name representing the variable, provided that the specific implementation has some sensible way of doing so.

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