Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/testthat/_snaps/call-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,24 @@
pv_focus(p, "outer")
pv_callers(p, "outer")

# pv_print_callers_callees shows none when callees empty

Code
pv_print_callers_callees(p, "bar")
Output
## FUNCTION ANALYSIS: bar


Total time: 10 ms (33.3% of profile)
Appearances: 1 samples

### Called by
1 samples (100.0%) foo

### Calls to
Callees: none

### Next steps
pv_focus(p, "bar")
pv_focus(p, "foo")

68 changes: 68 additions & 0 deletions tests/testthat/_snaps/compare.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,71 @@
pv_focus(p_before, "deep")
pv_focus(p_after, "deep")

# pv_print_compare shows improvements and regressions

Code
pv_print_compare(p1, p2)
Output
## PROFILE COMPARISON



### Overall
before_ms: 100
after_ms: 100
diff_ms: +0
speedup: 1.00x

### Biggest Changes
Function Before After Diff Change
slow_func 50 0 -50 -100%
new_func 0 50 +50 new

### Top Improvements
slow_func: 50 -> 0 (-50 ms)

### Regressions
new_func: 0 -> 50 (+50 ms)

### Next steps
pv_focus(p_before, "slow_func")
pv_focus(p_after, "slow_func")

# pv_compare_many requires at least 2 profiles

Code
pv_compare_many(a = p)
Condition
Error:
! At least 2 profiles are required for comparison.

# pv_compare_many requires named profiles

Code
pv_compare_many(p1, p2)
Condition
Error:
! All profiles must be named.

# pv_compare_many rejects non-profvis input

Code
pv_compare_many(a = p, b = list())
Condition
Error:
! 'b' must be a profvis object.

# pv_print_compare_many snapshot

Code
pv_print_compare_many(a = p1, b = p2)
Output
## MULTI-PROFILE COMPARISON


Rank Profile Time (ms) Samples vs Fastest
1* a 50 5 fastest
2 b 50 5 fastest

* = fastest

11 changes: 11 additions & 0 deletions tests/testthat/_snaps/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,14 @@
pv_focus(p, "x")
pv_gc_pressure(p)

# pv_print_suggestions handles profile with truly no suggestions

Code
pv_print_suggestions(p)
Output
## OPTIMIZATION SUGGESTIONS


No suggestions.
Run pv_help() to see all available functions.

121 changes: 121 additions & 0 deletions tests/testthat/_snaps/focus.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,124 @@
pv_focus(p, "bar")
pv_callers(p, "foo")

# pv_focus handles more than 5 callers

Code
pv_focus(p, "target")
Output
## FOCUS: target


### Time Analysis
Total time: 60 ms (100.0%) - time on call stack
Self time: 60 ms (100.0%) - time at top of stack
Child time: 0 ms ( 0.0%) - time in callees
Appearances: 6 samples

### Called By
1 calls ( 16.7%) caller1
1 calls ( 16.7%) caller2
1 calls ( 16.7%) caller3
1 calls ( 16.7%) caller4
1 calls ( 16.7%) caller5
... and 1 more callers

### Calls To
Callees: none

### Source Locations
Source references not available.
Use devtools::load_all() to enable.

### Next steps
pv_callers(p, "target")
pv_focus(p, "caller1")

# pv_focus shows callees none for leaf function

Code
pv_focus(p, "bar")
Output
## FOCUS: bar


### Time Analysis
Total time: 10 ms ( 33.3%) - time on call stack
Self time: 10 ms ( 33.3%) - time at top of stack
Child time: 0 ms ( 0.0%) - time in callees
Appearances: 1 samples

### Called By
1 calls (100.0%) foo

### Calls To
Callees: none

### Source Locations
Source references not available.
Use devtools::load_all() to enable.

### Next steps
pv_callers(p, "bar")
pv_focus(p, "foo")

# pv_focus handles more than 5 callees

Code
pv_focus(p, "target")
Output
## FOCUS: target


### Time Analysis
Total time: 60 ms (100.0%) - time on call stack
Self time: 0 ms ( 0.0%) - time at top of stack
Child time: 60 ms (100.0%) - time in callees
Appearances: 6 samples

### Called By
6 calls (100.0%) (top-level)

### Calls To
1 calls ( 16.7%) callee1
1 calls ( 16.7%) callee2
1 calls ( 16.7%) callee3
1 calls ( 16.7%) callee4
1 calls ( 16.7%) callee5
... and 1 more callees

### Source Locations
Source references not available.
Use devtools::load_all() to enable.

### Next steps
pv_focus(p, "callee1")
pv_callers(p, "target")

# pv_focus handles function with source refs but no self-time with source

Code
pv_focus(p, "target")
Output
## FOCUS: target


### Time Analysis
Total time: 10 ms (100.0%) - time on call stack
Self time: 0 ms ( 0.0%) - time at top of stack
Child time: 10 ms (100.0%) - time in callees
Appearances: 1 samples

### Called By
1 calls (100.0%) (top-level)

### Calls To
1 calls (100.0%) deep

### Source Locations
No self-time with source info.

### Next steps
pv_focus(p, "deep")
pv_callers(p, "target")

Loading
Loading