Commit 0b11d222 authored by Teng Qin's avatar Teng Qin

Use errno symbol instead of hard-coded numbers in offcputime.py

parent b755c709
...@@ -15,6 +15,7 @@ from bcc import BPF ...@@ -15,6 +15,7 @@ from bcc import BPF
from sys import stderr from sys import stderr
from time import sleep, strftime from time import sleep, strftime
import argparse import argparse
import errno
import signal import signal
# arg validation # arg validation
...@@ -215,10 +216,11 @@ for k, v in sorted(counts.items(), key=lambda counts: counts[1].value): ...@@ -215,10 +216,11 @@ for k, v in sorted(counts.items(), key=lambda counts: counts[1].value):
# handle get_stackid erorrs # handle get_stackid erorrs
if (not args.user_stacks_only and k.kernel_stack_id < 0) or \ if (not args.user_stacks_only and k.kernel_stack_id < 0) or \
(not args.kernel_stacks_only and k.user_stack_id < 0 and \ (not args.kernel_stacks_only and k.user_stack_id < 0 and \
k.user_stack_id != -14): k.user_stack_id != -errno.EFAULT):
missing_stacks += 1 missing_stacks += 1
# check for an ENOMEM error # check for an ENOMEM error
if k.kernel_stack_id == -12 or k.user_stack_id == -12: if k.kernel_stack_id == -errno.ENOMEM or \
k.user_stack_id == -errno.ENOMEM:
has_enomem = True has_enomem = True
continue continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment