nschloe / tuna

:fish: Python profile viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call stack depth is limited?

schmave opened this issue · comments

Hi there, Thanks for making this software available!

It seems like it could be really helpful to me, but when I tried running it on a pstats file, I couldn't see the info I wanted. Only 14 rows were shown, even though profile contains 20 or more. Is there a way to work around this?

stats-14-14-29.log

There's no limit in the depth of as far as I recall. What makes you think there is more data?

Gotcha. When I view it using snakeview or the builtin pstats module I see much more info than when I use tuna.

Okay, typical case of snakeviz showing incorrect information. Just look at the times and you'll see that something is amiss:

times

Nothing beyong exception.py:31 can be inferred from the profile, and tuna stops there. This is explained in the main readme as well.

tuna should perhaps make this more explicit. Looking into it.

Fixed by #71.

Yes, those confusing times (also visible elsewhere in the call tree) are part of what has me looking for other profiling/analysis tools.

Thanks for the quick fix.

One other suggestion/question... in this case the function call that I care about is backend/file_storage/views.py:80(post). All the confusing calls on top of that are Django middleware functions that are irrelevant (and from what you say, the data about them is ambiguous anyway). Is it possible to specify a different root function to tuna so that it only shows calls below that root?

Just click on it in the browser.

Well, at least with tuna v0.4.0, I don't see that function call in the browser, so I can't click on it.

I tried upgrading just now, both v0.4.1 and v0.4.2 seem to have some error that causes them not to load any additional JS/CSS files. I see this in the Python console:

$ tuna ~/Downloads/stats-14-14-29.log --port 8081
Starting httpd on port 8081

127.0.0.1 - - [24/Apr/2020 13:01:24] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [24/Apr/2020 13:01:24] "GET /static/tuna.css HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59635)
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 348, in process_request
    self.finish_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py", line 406, in handle_one_request
    method()
  File "/Users/evan/cs1-v2/venv/lib/python3.6/site-packages/tuna/main.py", line 229, in do_GET
    mimetype, _ = mimetypes.guess_type(filepath)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/mimetypes.py", line 291, in guess_type
    return _db.guess_type(url, strict)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/mimetypes.py", line 116, in guess_type
    scheme, url = urllib.parse.splittype(url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/parse.py", line 938, in splittype
    match = _typeprog.match(url)
TypeError: expected string or bytes-like object
----------------------------------------
127.0.0.1 - - [24/Apr/2020 13:01:24] "GET /static/bootstrap.min.css HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59637)
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 348, in process_request
    self.finish_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py", line 406, in handle_one_request
    method()
  File "/Users/evan/cs1-v2/venv/lib/python3.6/site-packages/tuna/main.py", line 229, in do_GET
    mimetype, _ = mimetypes.guess_type(filepath)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/mimetypes.py", line 291, in guess_type
    return _db.guess_type(url, strict)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/mimetypes.py", line 116, in guess_type
    scheme, url = urllib.parse.splittype(url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/parse.py", line 938, in splittype
    match = _typeprog.match(url)
TypeError: expected string or bytes-like object
----------------------------------------

...

and this in the browser:
image

Could be user error on my end, but I'm not sure.

I cannot reproduce the error. Also, I don't get what you mean by "you don't see that function".