Skip to content

Commit

Permalink
With the python3 move we can kill total_seconds() and run_threaded()
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaldessari committed Mar 2, 2015
1 parent d11a5f6 commit 62d00e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
- With the python3 move we can kill total_seconds() and run_threaded()

- disk.all.avactive help text talks about:
When converted to a rate, this metric represents the average utilization of all disks during
the sampling interval. A value of 0.25 (or 25%) means that on average every disk was active (i.e. busy) one
Expand Down
4 changes: 0 additions & 4 deletions src/pcp2pdf/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def __init__(self):
self.dpi = None
self.histogram = True
self.opts = self.setup()
self.threaded = run_threaded()
if not self.threaded:
print("Old python version detected. Disabling multi-threaded"
" processing")
configfiles = []
path = os.path.join(pmapi.pmContext.pmGetConfig('PCP_SYSCONF_DIR'),
NAME, NAME + ".conf")
Expand Down
13 changes: 3 additions & 10 deletions src/pcp2pdf/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ def match_res(patterns, string, flags=0):
return ret
return None


# Python 2.6 does not have total_seconds() in datetime objects
def total_seconds(timedelta):
return (timedelta.days * 3600 * 24 + timedelta.seconds +
timedelta.microseconds / 100000.0)


class PcpStats(object):
story = []

Expand Down Expand Up @@ -316,7 +309,7 @@ def rate_convert(self, timestamps, values):
new_timestamps.append(delta)

for v in range(1, len(values)):
seconds = total_seconds(new_timestamps[v - 1])
seconds = new_timestamps[v - 1].total_seconds()
try:
delta = (values[v] - values[v - 1]) / seconds
except ZeroDivisionError:
Expand Down Expand Up @@ -393,7 +386,7 @@ def get_frequency(self, data):
if not last:
last = timestamp
continue
delta = total_seconds(timestamp - last)
delta = (timestamp - last).total_seconds()
total += delta
counter += 1
last = timestamp
Expand Down Expand Up @@ -421,7 +414,7 @@ def find_data_gaps(self, data):
if not last:
last = timestamp
continue
delta = total_seconds(timestamp - last)
delta = (timestamp - last).total_seconds()
if delta > frequency * FREQUENCY_ERROR:
key = (last, timestamp)
if key not in ret:
Expand Down

0 comments on commit 62d00e3

Please sign in to comment.