Browse Source

[2225_statistics] rename _Counter() to Counter() and change its interface

Naoki Kambe 12 years ago
parent
commit
f5dc6575c1
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/lib/python/isc/statistics/counter.py

+ 3 - 2
src/lib/python/isc/statistics/counter.py

@@ -139,7 +139,7 @@ def _stop_timer(start_time, element, spec, identifier):
                     delta.microseconds * 1E-6, 6)
                     delta.microseconds * 1E-6, 6)
     _set_counter(element, spec, identifier, sec)
     _set_counter(element, spec, identifier, sec)
 
 
-class _Counter():
+class Counter():
     """A module for holding all statistics counters of modules. The
     """A module for holding all statistics counters of modules. The
     counter numbers can be accessed by the accesseers defined
     counter numbers can be accessed by the accesseers defined
     according to a spec file. In this class, the structure of per-zone
     according to a spec file. In this class, the structure of per-zone
@@ -192,11 +192,12 @@ class _Counter():
     # zone names are contained under this dirname in the spec file.
     # zone names are contained under this dirname in the spec file.
     _perzone_prefix = 'zones'
     _perzone_prefix = 'zones'
 
 
-    def __init__(self, spec_file_name):
+    def __init__(self, spec_file_name=None):
         self._zones_item_list = []
         self._zones_item_list = []
         self._start_time = {}
         self._start_time = {}
         self._disabled = False
         self._disabled = False
         self._rlock = threading.RLock()
         self._rlock = threading.RLock()
+        if not spec_file_name: return
         if self._perzone_prefix in \
         if self._perzone_prefix in \
                 isc.config.spec_name_list(self._statistics_spec):
                 isc.config.spec_name_list(self._statistics_spec):
             self._zones_item_list = isc.config.spec_name_list(
             self._zones_item_list = isc.config.spec_name_list(