1 |
antarus 08/05/02 07:24:59 |
2 |
|
3 |
Modified: process_timer |
4 |
Log: |
5 |
Change logging stuff so that -v 1 produces a few lines of helpful information and -v 2 adds more debugging |
6 |
|
7 |
Revision Changes Path |
8 |
1.5 users/antarus/projects/infra/process_timer |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/users/antarus/projects/infra/process_timer?rev=1.5&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/users/antarus/projects/infra/process_timer?rev=1.5&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo/users/antarus/projects/infra/process_timer?r1=1.4&r2=1.5 |
13 |
|
14 |
Index: process_timer |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/users/antarus/projects/infra/process_timer,v |
17 |
retrieving revision 1.4 |
18 |
retrieving revision 1.5 |
19 |
diff -u -r1.4 -r1.5 |
20 |
--- process_timer 2 May 2008 07:18:03 -0000 1.4 |
21 |
+++ process_timer 2 May 2008 07:24:58 -0000 1.5 |
22 |
@@ -1,5 +1,5 @@ |
23 |
#!/usr/bin/python |
24 |
-# $Header: /var/cvsroot/gentoo/users/antarus/projects/infra/process_timer,v 1.4 2008/05/02 07:18:03 antarus Exp $ |
25 |
+# $Header: /var/cvsroot/gentoo/users/antarus/projects/infra/process_timer,v 1.5 2008/05/02 07:24:58 antarus Exp $ |
26 |
# Copyright Alec Warner 2008 |
27 |
# Released in the public domain. |
28 |
|
29 |
@@ -7,6 +7,9 @@ |
30 |
|
31 |
Look in /proc, match on some regexes, offer to print pids that match |
32 |
options given by the user. |
33 |
+ |
34 |
+TODO: cmdline is an 'array' of null terminated strings and we don't handle that |
35 |
+correctly right now. |
36 |
""" |
37 |
|
38 |
|
39 |
@@ -40,9 +43,10 @@ |
40 |
opts.walltime = True |
41 |
|
42 |
if opts.verbose: |
43 |
- logging.getLogger().setLevel(10) |
44 |
+ for i in range(int(opts.verbose)): |
45 |
+ logging.getLogger().setLevel(logging.getLogger().getEffectiveLevel() - 10) |
46 |
|
47 |
- logging.debug('opts are %s' % opts) |
48 |
+ logging.info('opts are %s' % opts) |
49 |
|
50 |
return opts, args |
51 |
|
52 |
@@ -76,7 +80,7 @@ |
53 |
logging.debug('matched %s' % pid) |
54 |
matches.add((pid, cmdline)) |
55 |
|
56 |
- logging.debug('pids matched: %s' % matches) |
57 |
+ logging.info('pids matched: %s' % matches) |
58 |
|
59 |
return matches |
60 |
|
61 |
@@ -118,7 +122,7 @@ |
62 |
pids = FindPids(opts.prog) |
63 |
for pid in pids: |
64 |
times = CalculateTime(pid[0]) |
65 |
- logging.debug("Times: %s: %s" % (pid[1], times)) |
66 |
+ logging.info("Times: %s: %s" % (pid[1], times)) |
67 |
if opts.walltime: |
68 |
if times['wall'] / 100 > opts.time: |
69 |
print pid[0] |
70 |
|
71 |
|
72 |
|
73 |
-- |
74 |
gentoo-commits@l.g.o mailing list |