Page Speed Optimization Libraries
1.13.35.1
|
#include "statistics.h"
Public Member Functions | |
virtual int64 | Get () const =0 |
virtual StringPiece | GetName () const =0 |
virtual int64 | SetReturningPreviousValue (int64 value) |
virtual void | Set (int64 value)=0 |
void | Clear () |
int64 | Add (int64 delta) |
Protected Member Functions | |
virtual int64 | AddHelper (int64 delta)=0 |
This is virtual so that subclasses can add platform-specific atomicity. | |
UpDownCounters are variables that can also be decreased (e.g. Add of a negative number) or Set to an arbitrary value.
|
pure virtual |
Return some name representing the variable, provided that the specific implementation has some sensible way of doing so.
Implemented in net_instaweb::UpDownTemplate< Impl >, net_instaweb::UpDownTemplate< SharedMemVariable >, net_instaweb::UpDownTemplate< NullStatisticsVariable >, net_instaweb::UpDownTemplate< SimpleStatsVariable >, and net_instaweb::SplitUpDownCounter.
|
virtual |
Sets the specified value, returning the previous value. This can be used to by two competing threads/processes to determine which thread modified the value first. The default implementation is non-atomic, but implementations can override to provide an atomic version.
Non-atomic implementations may result in multiple concurrent updates each returning the old value. In an atomic implementation, only one concurrent update will return the old value.
Reimplemented in net_instaweb::SplitUpDownCounter.