File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
server/src/main/java/net/laprun/sustainability/power
sensors/macos/powermetrics Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .time .Duration ;
4
4
5
+ import jakarta .enterprise .event .Observes ;
5
6
import jakarta .inject .Inject ;
6
7
import jakarta .ws .rs .*;
7
8
import jakarta .ws .rs .core .MediaType ;
8
9
9
10
import org .jboss .resteasy .reactive .RestStreamElementType ;
10
11
12
+ import io .quarkus .logging .Log ;
13
+ import io .quarkus .runtime .StartupEvent ;
11
14
import io .smallrye .mutiny .Multi ;
12
15
13
16
@ Path ("/power" )
14
17
public class PowerResource {
15
18
@ Inject
16
19
PowerMeasurer measurer ;
17
20
21
+ public void onStartup (@ Observes StartupEvent event ) {
22
+ Log .info ("\n Configured sampling period: " + samplingPeriod () +
23
+ "\n Detected metadata:\n " + metadata ());
24
+ }
25
+
18
26
@ GET
19
27
@ RestStreamElementType (MediaType .APPLICATION_JSON )
20
28
@ Path ("{pid}" )
Original file line number Diff line number Diff line change 9
9
import java .util .HashSet ;
10
10
import java .util .regex .Pattern ;
11
11
12
- import io .quarkus .logging .Log ;
13
12
import net .laprun .sustainability .power .SensorMeasure ;
14
13
import net .laprun .sustainability .power .SensorMetadata ;
15
14
import net .laprun .sustainability .power .sensors .AbstractPowerSensor ;
@@ -89,7 +88,6 @@ void initMetadata(InputStream inputStream) {
89
88
final var metadata = new SensorMetadata (components ,
90
89
"macOS powermetrics derived information, see https://firefox-source-docs.mozilla.org/performance/powermetrics.html" );
91
90
cpu .setMetadata (metadata );
92
- Log .info ("Detected metadata:\n " + metadata );
93
91
} catch (IOException e ) {
94
92
throw new RuntimeException (e );
95
93
}
You can’t perform that action at this time.
0 commit comments