Comments (6)
Ok. This could be done in code level but I don't think it would make sense to try adding such column to the output we generate.(get_func_stats().print_all()
)
from yappi.
@sumerc Would also be cool to provide a special return value that could be used to turn off counting running a particular call. Like say you detect an error condition and you don't want it to count towards the average run time collected -- you return the constant and the profiler ignores that run of the function. Going to have another crack at extending this tomorrow.
from yappi.
you return the constant and the profiler ignores that run of the function
I could not understand the proposal here. A concrete example might be better?
from yappi.
you return the constant and the profiler ignores that run of the function
I could not understand the proposal here. A concrete example might be better?
You would do something like:
def code_to_profile():
if error_occured:
return yappi.SKIP_PROFILING
then in the C code hooks for leave (still studying the code): you would check if a function returned that value and if it did -- quit doing any kind of timing for that function run. The idea is that you could use this to time operations that may have inconsistent results where you're only interested in the run time of the most typical case.
For example: if you were benchmarking UDP code you might be interested to know how 'fast' your code can do send and recv / if there's any bottlenecks. So you would write code that does that -- however if a UDP packet gets lost then the function will timeout and artificially increase the average perceived cost of the call. It would be very useful to then say:
if no reply ... return yappi.SKIP_PROFILING to ignore that run.
from yappi.
I still think this is a beautiful program, btw @sumerc Respect to all the devs who have worked on this.
from yappi.
I still think this is a beautiful program, btw @sumerc Respect to all the devs who have worked on this.
Thank you. I think I have overlooked your previous comment.
For example: if you were benchmarking UDP code you might be interested to know how 'fast' your code can do send and recv / if there's any bottlenecks. So you would write code that does that -- however if a UDP packet gets lost then the function will timeout and artificially increase the average perceived cost of the call. It would be very useful to then say:
I see a valid use case here, but not sure if yappi is the right tool for the described scenario here. I would suggest using a line level profiler for this, there are even sampling line profilers available (scalene) if overhead is a problem. Moreover, I am usually reluctant to changes that require manual user intervention. Here, user needs to explicitly change code to enable/disable certain profiling features. IMHO, a profiler should be able to work with the least amount of code changes.
from yappi.
Related Issues (20)
- Tests are broken on Python 3.11 due to @asyncio.coroutine use HOT 1
- yappi fails to build with python 3.11
- `test_gevent` seems to depend on `3.10`
- Support more architectures in Github Actions
- Openssl related Error install Yappi with pip on pyton 3.11 OS:Windows HOT 1
- Python run `gevent` tests on CI for `3.11`
- New 3.11 compatible release? HOT 3
- base class names incorrect HOT 2
- Question: does yappi add "considerable runtime overhead"? Can it be used in production? HOT 2
- failing to capture FastAPI uvicorn threads, only seeing the _MainThread HOT 4
- sum(<genexpr>) not represented correctly in call graph
- Can't install on macOS HOT 2
- Uniqueness of the YFuncStat object
- Full path not printed HOT 2
- could you make the git tag name pattern consistent? HOT 1
- Irrelevant Thread Name for Gevent/Greenlet Profiling HOT 1
- Print only `N` lines of result HOT 1
- Yappi 3.12 `AttributeError: _mock_methods` when using MagicMock HOT 3
- Please add context-manager for easier of use HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yappi.