5
5
// LICENSE file or at:
6
6
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt
7
7
8
+ @file:Suppress(" INVISIBLE_MEMBER" , " INVISIBLE_REFERENCE" )
9
+
8
10
package io.bitdrift.microbenchmark
9
11
10
12
import androidx.benchmark.junit4.BenchmarkRule
11
13
import androidx.benchmark.junit4.measureRepeated
12
14
import androidx.test.ext.junit.runners.AndroidJUnit4
13
15
import io.bitdrift.capture.Capture
16
+ import io.bitdrift.capture.Configuration
17
+ import io.bitdrift.capture.LoggerImpl
18
+ import io.bitdrift.capture.providers.SystemDateProvider
14
19
import io.bitdrift.capture.providers.session.SessionStrategy
15
20
import okhttp3.HttpUrl.Companion.toHttpUrl
16
- import org.junit.Before
17
21
import org.junit.Rule
18
22
import org.junit.Test
19
23
import org.junit.runner.RunWith
@@ -32,24 +36,39 @@ class ClockTimeProfiler {
32
36
@get:Rule
33
37
val benchmarkRule = BenchmarkRule ()
34
38
35
- @Before
36
- fun setUp () {
39
+ private fun startLogger () {
37
40
Capture .Logger .start(
38
41
apiKey = " android-benchmark-test" ,
39
42
apiUrl = " https://api-tests.bitdrift.io" .toHttpUrl(),
40
43
sessionStrategy = SessionStrategy .Fixed (),
41
44
)
42
45
}
43
46
47
+ @Test
48
+ fun loggerStart () {
49
+ benchmarkRule.measureRepeated {
50
+ LoggerImpl (
51
+ apiKey = " android-benchmark-test" ,
52
+ apiUrl = " https://api-tests.bitdrift.io" .toHttpUrl(),
53
+ fieldProviders = listOf (),
54
+ dateProvider = SystemDateProvider (),
55
+ configuration = Configuration (),
56
+ sessionStrategy = SessionStrategy .Fixed (),
57
+ )
58
+ }
59
+ }
60
+
44
61
@Test
45
62
fun logNotMatchedNoFields () {
63
+ startLogger()
46
64
benchmarkRule.measureRepeated {
47
65
Capture .Logger .logInfo { LOG_MESSAGE }
48
66
}
49
67
}
50
68
51
69
@Test
52
70
fun logNotMatched5Fields () {
71
+ startLogger()
53
72
benchmarkRule.measureRepeated {
54
73
Capture .Logger .logInfo(
55
74
mapOf (
@@ -65,6 +84,7 @@ class ClockTimeProfiler {
65
84
66
85
@Test
67
86
fun logNotMatched10Fields () {
87
+ startLogger()
68
88
benchmarkRule.measureRepeated {
69
89
Capture .Logger .logInfo(
70
90
mapOf (
0 commit comments