|
1 | 1 | import fxprof.*, tracer.Tracer |
2 | | -import com.github.plokhotnyuk.jsoniter_scala.core._ |
3 | 2 | import decline_derive.CommandApplication |
4 | | -import java.util.concurrent.atomic.AtomicInteger |
5 | | -import scala.reflect.ClassTag |
6 | | -import java.util.concurrent.atomic.AtomicBoolean |
7 | | - |
8 | | -val meta = ProfileMeta( |
9 | | - interval = 1.0, |
10 | | - startTime = java.time.Instant.now().toEpochMilli, |
11 | | - processType = 1.0, |
12 | | - product = ProfileMeta_Product.Other("scala-native"), |
13 | | - stackwalk = ProfileMeta_Stackwalk.False, |
14 | | - version = 1.0, |
15 | | - preprocessedProfileVersion = 58 |
16 | | -).withInitialVisibleThreads(Some(Vector(0))) |
17 | | - .withMarkerSchema( |
18 | | - Vector( |
19 | | - MarkerSchema("test-marker").withDisplay( |
20 | | - Vector(MarkerDisplayLocation.MarkerChart) |
21 | | - ) |
22 | | - ) |
23 | | - ) |
24 | | - .withCategories( |
25 | | - Some( |
26 | | - Vector( |
27 | | - Category("interflow", CategoryColor.Blue), |
28 | | - Category("lower", CategoryColor.Green), |
29 | | - Category("emitLLVM", CategoryColor.Red) |
30 | | - ) |
31 | | - ) |
32 | | - ) |
33 | 3 |
|
34 | 4 | case class Config(out: String) derives CommandApplication |
35 | 5 |
|
36 | 6 | @main def sampleGenerate(args: String*) = |
37 | | - val t = Tracer( |
38 | | - meta.withCategories( |
| 7 | + // Setup the metadata for the profile |
| 8 | + val meta = ProfileMeta( |
| 9 | + interval = 1.0, |
| 10 | + startTime = System.currentTimeMillis(), |
| 11 | + processType = 1.0, |
| 12 | + product = ProfileMeta_Product.Other("scala-native-2"), |
| 13 | + stackwalk = ProfileMeta_Stackwalk.False, |
| 14 | + version = 1.0, |
| 15 | + preprocessedProfileVersion = 58 |
| 16 | + ) |
| 17 | + // Categories defined below can be used to start spans |
| 18 | + // if a span is started with a category that is not defined here, "default" will be used |
| 19 | + // "default" is added implicitly to the profile when it's serialised |
| 20 | + .withCategories( |
39 | 21 | Some( |
40 | 22 | Vector( |
41 | | - Category("lowering", CategoryColor.Yellow), |
42 | | - Category("optimising", CategoryColor.Blue), |
43 | | - Category("emitting", CategoryColor.Green) |
| 23 | + Category("lowering", CategoryColor.Blue), |
| 24 | + Category("emitting", CategoryColor.Green), |
| 25 | + Category("optimising", CategoryColor.Red) |
44 | 26 | ) |
45 | 27 | ) |
46 | 28 | ) |
47 | | - ) |
| 29 | + |
| 30 | + val t = Tracer(meta) |
48 | 31 |
|
49 | 32 | t.span("bla ", "lowering") { |
50 | 33 | t.span("bla.constants", "lowering") { |
@@ -72,6 +55,7 @@ case class Config(out: String) derives CommandApplication |
72 | 55 |
|
73 | 56 | val prof = t.build() |
74 | 57 |
|
| 58 | + import com.github.plokhotnyuk.jsoniter_scala.core._ |
75 | 59 | println(prof.shared.stringArray.zipWithIndex) |
76 | 60 | println("\nFunc table:") |
77 | 61 | println(writeToString(prof.threads(0).funcTable)) |
|
0 commit comments