Skip to content

Commit

Permalink
In python-psutil v2.* create_time is a method
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Jan 25, 2015
1 parent 6ab0746 commit 728edc6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tracer/resources/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def owned_by(self, user):
return self.filtered(lambda process: process.username == user)

def newer_than(self, timestamp):
return self.filtered(lambda process: process.create_time >= timestamp)
return self.filtered(lambda process: process.create_time() >= timestamp)

def unique(self):
unique = set()
Expand Down
2 changes: 1 addition & 1 deletion tracer/resources/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def exe(self):
@property
def str_started_ago(self):
now = datetime.datetime.fromtimestamp(time.time())
started = datetime.datetime.fromtimestamp(self.create_time)
started = datetime.datetime.fromtimestamp(self.create_time())
started = now - started

started_str = ""
Expand Down
4 changes: 2 additions & 2 deletions tracer/resources/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def trace_affected(self, user=None):
if p.pid in found:
continue

if p.create_time <= package.modified:
if p.create_time() <= package.modified:
found.append(p.pid)
p = self._apply_rules(p)
a = self._applications.find(p.name)
Expand Down Expand Up @@ -137,7 +137,7 @@ def _affecting_processes(self, process, packages):
if not package_file in process_files:
continue

if process.create_time <= package.modified:
if process.create_time() <= package.modified:
matching_files.add(package_file)

if matching_files:
Expand Down
1 change: 1 addition & 0 deletions tracer/views/resource/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ def render(self):
line = "{0:<10}{1:<20}{2:<20}{3:<10}"
print line.format("PID", "Time running", "User", "Process")
print 100 * "-"
# @FIXME sorting doesn't work correctly
for process in self.args.processes.sorted("create_time"):
print line.format(process.pid, process.str_started_ago, process.username, process.name)

0 comments on commit 728edc6

Please sign in to comment.