Skip to content

Commit

Permalink
better state default value handling
Browse files Browse the repository at this point in the history
  • Loading branch information
brendangregg authored and drzaeus77 committed Aug 11, 2017
1 parent 843340d commit 4870819
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/offcputime.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ def positive_nonzero_int(val):
type=positive_nonzero_int,
help="the amount of time in microseconds under which we " +
"store traces (default U64_MAX)")
parser.add_argument("--state", default=999,
type=positive_int,
parser.add_argument("--state", type=positive_int,
help="filter on this thread state bitmask (eg, 2 == TASK_UNINTERRUPTIBLE" +
") see include/linux/sched.h")
args = parser.parse_args()
Expand Down Expand Up @@ -184,7 +183,7 @@ def signal_ignore(signal, frame):
thread_filter = '1'
if args.state == 0:
state_filter = 'prev->state == 0'
elif args.state != 999:
elif args.state:
# these states are sometimes bitmask checked
state_filter = 'prev->state & %d' % args.state
else:
Expand Down

0 comments on commit 4870819

Please sign in to comment.