File: count.py

package info (click to toggle)
spring 103.0%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 43,720 kB
  • ctags: 63,685
  • sloc: cpp: 368,283; ansic: 33,988; python: 12,417; java: 12,203; awk: 5,879; sh: 1,846; xml: 655; perl: 405; php: 211; objc: 194; makefile: 77; sed: 2
file content (23 lines) | stat: -rwxr-xr-x 604 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python
# counts cmds between NEWFRAMES and prints anything above 400
# usage: ./demotool -d /path/to/some/demo.sdf |./count.py
import sys
import fileinput

count = 0
paused = False
for line in fileinput.input():
	args = line.strip().split(" ")
	if len(args)>1 and args[1] == "NEWFRAME":
		if count>400:
			print("%s %s" % (args[0], count))
		count = 0
		sumframes = 0
	elif len(args) == 6 and args[1] == "NETMSG_PAUSE:": # filter pause
		#000009 NETMSG_PAUSE: Player 8 paused: 1
		count = 0
		paused = (args[5] == "1")
		#print("paused: " + str(paused))
	elif not paused:
		count = count + 1