A pointer to a single counter within a binary counters file.
| 328 | |
| 329 | |
| 330 | class Counter(object): |
| 331 | """A pointer to a single counter within a binary counters file.""" |
| 332 | |
| 333 | def __init__(self, data, offset): |
| 334 | """Create a new instance. |
| 335 | |
| 336 | Args: |
| 337 | data: the shared data access object containing the counter |
| 338 | offset: the byte offset of the start of this counter |
| 339 | """ |
| 340 | self.data = data |
| 341 | self.offset = offset |
| 342 | |
| 343 | def Value(self): |
| 344 | """Return the integer value of this counter.""" |
| 345 | return self.data.IntAt(self.offset) |
| 346 | |
| 347 | def Name(self): |
| 348 | """Return the ascii name of this counter.""" |
| 349 | result = "" |
| 350 | index = self.offset + 4 |
| 351 | current = self.data.ByteAt(index) |
| 352 | while current: |
| 353 | result += chr(current) |
| 354 | index += 1 |
| 355 | current = self.data.ByteAt(index) |
| 356 | return result |
| 357 | |
| 358 | |
| 359 | class CounterCollection(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…