Closed jplusc closed 4 years ago
Thanks.
There's a couple of issues with this change:
The count
variable is reset each time the header is output, so if the header is output every 30 rows the maximum value for J#
is 30 - but what if you wanted to exit after 60 rows (ie. 2 "groups" of 30 rows)? That wouldn't be possible, and the exit will never be triggered whenever H#
is less than J#
d10 J2
incurs an unnecessary extra time.sleep(10)
delay after the second line is output, which should be avoided
I think you can solve both issues with the following changes to this PR:
diff --git a/bcmstat.sh b/bcmstat.sh
index a744972..7147156 100755
--- a/bcmstat.sh
+++ b/bcmstat.sh
@@ -1638,6 +1638,7 @@ def main(args):
getMemDeltas(DELTAS, MEM, GPU)
count = HDREVERY
+ tcount = 0
firsthdr = True
display_flags = {"threshold": STATS_THRESHOLD,
@@ -1661,15 +1662,13 @@ def main(args):
PEAKVALUES.update({"04#UVOLT":0, "05#FCAPPED":0, "06#THROTTLE":0})
while [ True ]:
- if QEVERY > 0 and count >= QEVERY and firsthdr == False:
- #return
- raise KeyboardInterrupt
if HDREVERY != 0 and count >= HDREVERY:
if not QUIET or not firsthdr: printn("\n\n")
ShowHeadings(display_flags, sysinfo)
firsthdr = False
count = 0
count += 1
+ tcount+= 1
if STATS_THRESHOLD:
HARDWARE.GetThresholdValues(UFT, STATS_THRESHOLD_CLEAR)
@@ -1718,6 +1717,9 @@ def main(args):
PEAKVALUES = n
+ if QEVERY > 0 and tcount >= QEVERY:
+ raise KeyboardInterrupt
+
time.sleep(DELAY)
if __name__ == "__main__":
Can you test the change and confirm it still gives you what you want (and update the PR)? Thanks!
Thanks for the feedback!
i've added the separate count variable and removed the verbiage from the help output that warned "must be less or same as header iterations".
i've also moved the check for the exit condition to avoid the unnecessary delay.
seems to still work as I would like : ) PR updated. thanks!
Thanks!
Added an option to exit the script after n iterations. used the option J for this as not many letters left, "Jump out of script" maybe?
it just issues a KeyboardInterrupt so we still get the Peak Values line.
added to arg parsing, added to help display, and added script logic.
thanks!