Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Error assert abs(call_ratio*total - partial) <= 0.001*call_ratio*total #7

Open
ArkeologeN opened this issue Aug 13, 2015 · 5 comments

Comments

@ArkeologeN
Copy link

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?

@jrfonseca
Copy link
Owner

Please provide the input users.001928ms.1439448963.prof input, e.g., via http://pastebin.com/

@ArkeologeN
Copy link
Author

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

@jrfonseca
Copy link
Owner

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.

@ArkeologeN
Copy link
Author

I've just published that up here: https://github.com/ArkeologeN/callgrind-output

@jrfonseca
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants