# Getting performance information from testsets

**URL:** <https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417>\
**Category:** General Usage\
**Created:** [August 2, 2023, 6:51pm UTC](https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417 "2023-08-02T18:51:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [August 2, 2023, 6:51pm UTC](https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417/1 "2023-08-02T18:51:58Z")

</div>

Testsets know already how much time they took to execute:

```julia
using Test

ts = @testset "outer" begin
    sleep(0.1)
end

# ts.time_end - ts.time_start = 0.10119009017944336

```

However, I would like to also know some other information like allocations and compile times etc.  
I have a few hundred testsets and would like to programmatically do things like search for the testset that had the highest `total_time - compile_time` etc.

What is the best way to do this? Can it be done without annotating every single testset?

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [August 2, 2023, 8:20pm UTC](https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417/2 "2023-08-02T20:20:39Z")

</div>

Probably the easiest idea is to wrote your own macro that expands to `@testset` and just wraps it in some code that measures whatever performance indicators you find interesting plus some code to add that to some global bookkeeping datastructure such that you can query the information later. Then you do not need to annotate all testsets yourself but just use a different macro instead of @testset.
