plasma-umass / scalene

Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals
Apache License 2.0
11.55k stars 387 forks source link

Filtering and exclusion by library or module #835

Open mcarans opened 1 month ago

mcarans commented 1 month ago

Is your feature request related to a problem? Please describe. I want to be able to profile all but restrict which dependent libraries are profiled.

Describe the solution you'd like There should be a way to exclude certain libraries or modules (not files because that is too granular).

Describe alternatives you've considered I cannot think of an alternative that is feasible. Specifying every file I want to profile is not practical.

emeryberger commented 1 month ago

Have you tried some combination of these? (From scalene --help)

  --profile-only PROFILE_ONLY
                        profile only code in filenames that contain the given strings, separated by commas (default: no 
restrictions)
  --profile-exclude PROFILE_EXCLUDE
                        do not profile code in filenames that contain the given strings, separated by commas (default: no 
restrictions)

For example, --profile-all --profile-exclude libname1,libname2

mcarans commented 1 month ago

I missed --profile-exclude which is not listed in the README.md under the section entitled "Click to see all Scalene's options ": https://github.com/plasma-umass/scalene#scalene

That certainly helps. I could exclude threading which seemed to be dominating the results. I think it would still be useful to be able to specify what dependent libraries to include in or exclude from profiling.