@@ -532,34 +532,34 @@ while True:
532532 outv = get_username (fields_dict ['uid' ])
533533
534534 elif field_name == ('offcpu_k' ): # kstack id
535- if state != 'R' : # runnable state can be R or RQ: RQ is also off CPU, so will capture it
536- val = fields_dict [ field_name ]
537- outv = val if val > 0 else '-'
535+ val = fields_dict [ field_name ]
536+ if state != 'R' and val > 0 : # runnable state can be R or RQ: RQ is also off CPU, so will capture it
537+ outv = val
538538 output_kstack [val ] = True
539539 else :
540540 outv = '-'
541541
542542 elif field_name == ("offcpu_u" ): # ustack id
543- if state != 'R' :
544- val = fields_dict [ field_name ]
545- outv = val if val > 0 else '-'
543+ val = fields_dict [ field_name ]
544+ if state != 'R' and val > 0 :
545+ outv = val
546546 # using pid/tgid here, address space is same for all threads in a process
547547 output_ustack [val , fields_dict ['pid' ]] = True
548548 else :
549549 outv = '-'
550550
551551 elif field_name == ('oncpu_k' ):
552- if state == 'R' : # only print the perf-cpu samples when actually caught on cpu (not runqueue) for now
553- val = fields_dict [ field_name ]
554- outv = val if val > 0 else '-'
552+ val = fields_dict [ field_name ]
553+ if state == 'R' and val > 0 : # only print the perf-cpu samples when actually caught on cpu (not runqueue) for now
554+ outv = val
555555 output_kstack [val ] = True
556556 else :
557557 outv = '-'
558558
559559 elif field_name == ("oncpu_u" ):
560- if state == 'R' :
561- val = fields_dict [ field_name ]
562- outv = val if val > 0 else '-'
560+ val = fields_dict [ field_name ]
561+ if state == 'R' and val > 0 :
562+ outv = val
563563 # using pid/tgid here, address space is same for all threads in a process
564564 output_ustack [val , fields_dict ['pid' ]] = True
565565 else :
0 commit comments