Assertion Error assert abs(call_ratio*total - partial) <= 0.001*call_ratio*total
Opened this issue · 5 comments
I've a .prof
file exported with the flag --kcachegrind
while running django-extention - runprofileserver
. The file looks like this: users.001928ms.1439448963.prof
Based upon the help, I found that I've to format it well first and then export .dot
file to make the png
.
Here's the what I ran for formatting and generating .dot
file.
$ gprof2dot --format=callgrind --output=output.dot users.001928ms.1439448963.prof
The error I got:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/bin/gprof2dot", line 9, in <module>
load_entry_point('gprof2dot==2015.2.3', 'console_scripts', 'gprof2dot')()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gprof2dot.py", line 3145, in main
profile = parser.parse()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gprof2dot.py", line 1565, in parse
self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gprof2dot.py", line 478, in integrate
self._integrate_function(function, outevent, inevent)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gprof2dot.py", line 483, in _integrate_function
return self._integrate_cycle(function.cycle, outevent, inevent)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gprof2dot.py", line 538, in _integrate_cycle
assert abs(call_ratio*total - partial) <= 0.001*call_ratio*total
AssertionError
Any luck / help about it? Why gprof2dot
is crashing?
Please provide the input users.001928ms.1439448963.prof input, e.g., via http://pastebin.com/
File size is > 1mb but here's the few chunk:
events: Ticks
summary: 1928
fi=~
fn=('~', 0, "<method 'find' of 'bytearray' objects>")
0 0
fi=~
fn=('~', 0, "<method 'translate' of 'bytearray' objects>")
0 0
fi=~
fn=('~', 0, "<method 'decode' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'find' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'lower' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'rstrip' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'startswith' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'strip' of 'bytes' objects>")
0 0
fi=~
fn=('~', 0, "<method 'get' of 'mappingproxy' objects>")
0 0
In that case please compress it and upload to google-drive dropbox, etc.. If you rather not share it publicly, email it to jose dot r dot fonseca at gmail dot com. I'm afraid that, unless I can repro it, there's nothing I can do.
But even if you do, I don't have high hopes for this: these are python functions. That is, this callgrind file is not actually generated by valgrind, but rather produced by a different tool (django). So my guess is that django is producing bad / inconsistent data.
Given it's python, there's probably some way to dump the python profiler data. You probably will have more luck with it.
I've just published that up here: https://github.com/ArkeologeN/callgrind-output
The graph is a huge cycle. Instead of the call graph being a DAG, it's one massive cycle -- ie, there's practically no function that doesn't call itself, mostly due to magic like overriding getattribute, etc.
And gprof2dot, as it currently stands, can't produce any meaningful graph out of it.
I have some ideas to enhance gprof2dot to integrate time based on call-stacks, rather than branches along a graph. But until that happens there's nothing I can do.