Skip to content

Commit bc5d6bf

Browse files
committed
Setup file override for scalafmt
1 parent 7949e25 commit bc5d6bf

2 files changed

Lines changed: 30 additions & 36 deletions

File tree

.scalafmt.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
version = "3.10.2"
22
runner.dialect = scala212source3
3+
4+
fileOverride {
5+
"glob:**/fxprof-sample/src/main/scala/**" {
6+
runner.dialect = scala3
7+
}
8+
9+
"glob:**/fxprof-codegen/src/main/scala/**" {
10+
runner.dialect = scala3
11+
}
12+
}

mod/fxprof-sample/src/main/scala/sample.scala

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,33 @@
11
import fxprof.*, tracer.Tracer
2-
import com.github.plokhotnyuk.jsoniter_scala.core._
32
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-
)
333

344
case class Config(out: String) derives CommandApplication
355

366
@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(
3921
Some(
4022
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)
4426
)
4527
)
4628
)
47-
)
29+
30+
val t = Tracer(meta)
4831

4932
t.span("bla ", "lowering") {
5033
t.span("bla.constants", "lowering") {
@@ -72,6 +55,7 @@ case class Config(out: String) derives CommandApplication
7255

7356
val prof = t.build()
7457

58+
import com.github.plokhotnyuk.jsoniter_scala.core._
7559
println(prof.shared.stringArray.zipWithIndex)
7660
println("\nFunc table:")
7761
println(writeToString(prof.threads(0).funcTable))

0 commit comments

Comments
 (0)