Monday 11 June 2007

Analysing Wine logs

Well, I played Total Annihilation (with the speakers turned down). Then I decided it was time to analyse the error logs.

I wrote a little bit of Ruby which condensed the 1.3MB of Wine log down to:

There were 12021 occurrences of err:dsound:DSOUND_MixOne
There were 6900 occurrences of err:dsound:DSOUND_PhaseCancel
There was 1 occurrence of fixme:d3d:IWineD3DDeviceImpl_GetAvailableTextureMem
There were 11 occurrences of fixme:d3d:IWineD3DStateBlockImpl_Release
There was 1 occurrence of fixme:d3d_surface:IWineGDISurfaceImpl_Blt
There were 22 occurrences of fixme:ddraw:IDirectDrawImpl_SetCooperativeLevel
There were 14 occurrences of fixme:dsound:DSOUND_MixOne
There were 3 occurrences of fixme:system:SystemParametersInfoW
There were 11 occurrences of fixme:xrandr:X11DRV_XRandR_SetCurrentMode


So I played the game again, with the sound and music switched off, and leaping onto the Narration button to switch it off at the start of each mission. This gave a log which condensed down to:

There were 7 occurrences of err:dsound:DSOUND_MixOne
There was 1 occurrence of fixme:d3d:IWineD3DDeviceImpl_GetAvailableTextur
There were 7 occurrences of fixme:d3d:IWineD3DStateBlockImpl_Release
There were 14 occurrences of fixme:ddraw:IDirectDrawImpl_SetCooperativeLevel
There were 17 occurrences of fixme:dsound:DSOUND_MixOne
There were 3 occurrences of fixme:system:SystemParametersInfoW
There were 7 occurrences of fixme:xrandr:X11DRV_XRandR_SetCurrentMode
There was 1 occurrence of preloader:


For anyone interested, the Ruby code which processed the Wine logs was

# For extracting a count of the various error messages in a Wine log
# My 2nd Ruby applicette (c) xlucid May 2007
# (c) xlucid May 2007 for http://playingwithlinux.blogspot.com Use freely. Keep this line.
# http://playingwithlinux.blogspot.com

aDictionary = Hash.new(0)
aMessage = Regexp.new(/^[^\s]+/) # everything at the start of each line, until the first space

aFile = File.open("put the path and name of your logfile here")


# Count the occurrences of each error message

aFile.each_line { |aLine|
anErr = aLine.slice(aMessage)
aDictionary[anErr] = aDictionary[anErr] + 1
}
aFile.close

# Sort the error messages alphabetically

anArray = aDictionary.sort
aDictionary = Hash.new(0)
anArray.each_index { |i| aDictionary[anArray[i][0]] = anArray[i][1] }

# Print out the number of occurrences of each error message, grammatically, and aligned for any number up to 999

anArray.each_index { |i|
if anArray[i][1] > 99
print "There were ", anArray[i][1], " occurrences of ", anArray[i][0], "\n"
elsif anArray[i][1] > 9
print "There were ", anArray[i][1], " occurrences of ", anArray[i][0], "\n"
elsif anArray[i][1] > 1
print "There were ", anArray[i][1], " occurrences of ", anArray[i][0], "\n"
else
print "There was 1 occurrence of ", anArray[i][0], "\n"
end
}

puts "\r\n\r\n"

No comments: