<s> """<STR_LIT>""" <EOL> class PerfCounter ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , description ) : <EOL> if name in Registry . get_all_counter_names ( ) : <EOL> raise Exception ( '<STR_LIT>' % name ) <EOL> self . _name = name <EOL> self . _description = description <EOL> self . _value = <NUM_LIT:0> <EOL> Registry . register_counter ( self . name , self ) <EOL> def inc ( self , increment = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> self . _value += increment <EOL> @ property <EOL> def name ( self ) : <EOL> return self . _name <EOL> @ property <EOL> def description ( self ) : <EOL> return self . _description <EOL> @ property <EOL> def value ( self ) : <EOL> return self . _value <EOL> class Registry ( object ) : <EOL> """<STR_LIT>""" <EOL> _counters = { } <EOL> @ classmethod <EOL> def get_all_counter_names ( cls ) : <EOL> return cls . _counters . keys ( ) <EOL> @ classmethod <EOL> def get_all_counters ( cls ) : <EOL> return cls . _counters . values ( ) <EOL> @ classmethod <EOL> def register_counter ( cls , name , counter_class ) : <EOL> cls . _counters [ name ] = counter_class <EOL> MEMCACHE_HIT = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_MISS = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_SET_SUCCESS = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_SET_FAILURE = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_DELETE_SUCCESS = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_DELETE_MISSING = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> MEMCACHE_DELETE_FAILURE = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> HTML_RESPONSE_TIME_SECS = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> HTML_RESPONSE_COUNT = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> JSON_RESPONSE_TIME_SECS = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> JSON_RESPONSE_COUNT = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> EMAILS_SENT = PerfCounter ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) </s>
