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

Recursive dive in to a function source #5

Open
PrzemyslawKlys opened this issue Jun 18, 2020 · 1 comment
Open

Recursive dive in to a function source #5

PrzemyslawKlys opened this issue Jun 18, 2020 · 1 comment

Comments

@PrzemyslawKlys
Copy link

I would like to measure my script problems. But since I mostly deal with functions that I create doing:

Measure-Script {
    MyFunction
}

Doesn't bring me any useful results. It would be nice if it would dive (or as you said "explode") into MyFunction and then asses it instead of just doing what it does now.

Thanks, looking forward to improving some of my code with your measurements.

@IISResetMe
Copy link
Owner

IISResetMe commented Jun 19, 2020

As mentioned in Twitter this is definitely possible for script functions. One of the ideas I had was to pass an include list of functions to expand, if not recursively then at least from the immediate script block scope, and then use that to choose which functions to explode and instrument, like:

$measurement = Measure-Script {
  # ... 
  ... |ForEach-Object {
    Call-Function $_
  }
  # ...
} -ExplodeFunction 'Call-Function'

$measurement.ProfiledFunctions['Call-Function'] # would hold line measures for `Call-Function` execution

@jaapbrasser mentioned he also had something in mind for this, let's see what he comes up with :)

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

No branches or pull requests

2 participants