Getting crash, dirty exit, and clean exit counts


This morning I saw a post taking a poll on how often 2014 SP2 crashes. So, here’s some crash numbers from my system:
CER_data_2
There’s a big difference in the number of sessions, so a percentage chart might make it easier to compare the versions:
CER_data_1

Crashes are actual crashes caught by CER. What I called “dirty exits” are exits or crashes not caught by CER. For example, killing xsi.exe in the Task Manager is a dirty exit. Clean exits are when you quit Softimage normally (for example, when you click File > Exit or the Close X icon).

I used this Python snippet to extracts the CER crash data from the registry.

#HKEY_USERS\S-1-5-21-1384716164-225505876-396224183-1000\
#   Software\Softimage\SOFTIMAGE|SICORE Engine\C:|Program Files|Autodesk|Softimage 2014 SP2|Application|bin\ProductInfo

from _winreg import *

# dicts keyed by Softimage version
dCrashes = {}
dCleanCloses = {}
dStarts = {}

#
# Get the CER crash data for each SI version
# under the SOFTIMAGE|SICORE Engine key
# 
def enum_sicore( subkey ):
	try:
		i = 0
		k = OpenKey( HKEY_USERS, "%s\Software\Softimage\SOFTIMAGE|SICORE Engine" % subkey,  0, KEY_READ )
		while True:
			subkey1 = EnumKey(k, i)
			
			# extract product name eg "Softimage 2014 SP2"
			s = subkey1.rsplit( '|' )[3]
			
			pi_key = OpenKey( k, "%s\%s" % (subkey1,"ProductInfo"), 0, KEY_READ )

			value = QueryValueEx(pi_key, "crashCount" )
			dCrashes[ s ] = value[0]

			value = QueryValueEx(pi_key, "SessionCleanCloseCount" )
			dCleanCloses[ s ] = value[0]

			value = QueryValueEx(pi_key, "SessionStartCount" )
			dStarts[ s ] = value[0]

			i += 1
	except WindowsError:
		# WindowsError: [Errno 259] No more data is available    
		pass

#
# For each user
#  
try:
	i = 0
	while True:
		subkey = EnumKey(HKEY_USERS, i)
		enum_sicore( subkey )
		i += 1
except WindowsError:
	# WindowsError: [Errno 259] No more data is available    
	pass
	
#
# Print out the numbers
#
crashes = 0
exits = 0
starts = 0

for key in dCrashes:
	print key
	print "   Crashes: %d" % dCrashes[key]
	print "   Dirty Exits: %d" % (dStarts[key] - dCleanCloses[key])
	print "   Starts: %d" % dStarts[key]
	
	crashes += dCrashes[key]
	exits += (dStarts[key] - dCleanCloses[key])
	starts += dStarts[key]

# Print out CSV for export into Excel for charting
for key in dCrashes:
	print "%s, %d, %d, %d" % (key, dCrashes[key], dStarts[key] - dCleanCloses[key], dStarts[key])