1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package bench.flame.diff.config
17 
18 import java.nio.file.Path
19 import kotlin.io.path.name
20 
21 internal object Paths {
22     val currentDir get() = Path.of("").toAbsolutePath()
23     private val dependenciesDir get() = currentDir.resolve(".deps")
24     val savedTracesDir get() = currentDir.resolve("saved-traces")
25     val savedDiffsDir get() = currentDir.resolve("saved-diffs")
26     val outDir get() = frameworksSupportDir.parent.parent.resolve("out")
<lambda>null27     private val frameworksSupportDir get() = currentDir.parent.parent.also {
28         check(it.parent.name == "frameworks" && it.name == "support")
29     }
30     val simpleperfDir get() = dependenciesDir.resolve("simpleperf")
31     val stackcollapsePy get() = simpleperfDir.resolve("stackcollapse.py")
32     val flamegraphDir get() = dependenciesDir.resolve("Flamegraph")
33     val flamegraphPl get() = flamegraphDir.resolve("flamegraph.pl")
34     val difffoldedPl get() = flamegraphDir.resolve("difffolded.pl")
35 
36     val traceFileNamePattern = ".*stackSampling.*\\.trace"
37 }
38 
39 internal object Uris {
40     // Using jgielzak@ fork of https://github.com/brendangregg/FlameGraph until
41     // https://github.com/brendangregg/FlameGraph/pull/329 is merged.
42     val flamegraphGitHub = "https://github.com/gielzak/FlameGraph"
43 
44     // Using a snapshot of Simpleperf until https://r.android.com/2980531 makes it into the NDK.
45     // Next check: 2024-Q4.
46     val simpleperfGoogleSource =
47         "https://android.googlesource.com/platform/system/extras/+archive/" +
48                 "436786af3a357db5fd72cdac97903d6d587944a1/simpleperf/scripts.tar.gz"
49 }
50