File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
measure/src/main/java/net/laprun/sustainability/power/measure Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -121,19 +121,27 @@ public Duration duration() {
121
121
122
122
@ Override
123
123
public DoubleStream getMeasuresFor (int component ) {
124
+ final double [] measuresForComponent = getLiveMeasuresFor (component );
125
+ if (measuresForComponent == null || measuresForComponent .length == 0 ) {
126
+ return DoubleStream .empty ();
127
+ }
128
+ return Arrays .stream (measuresForComponent , 0 , samples );
129
+ }
130
+
131
+ public double [] getLiveMeasuresFor (int component ) {
124
132
if (nonZeroComponents .get (component )) {
125
- return Arrays . stream ( measures [component ], 0 , samples ) ;
133
+ return measures [component ];
126
134
} else {
127
135
final var match = syntheticComponents .stream ()
128
136
.filter (rsc -> targetComponentExistsAndIsRecorder (component , rsc ))
129
137
.map (rsc -> (Recorder ) rsc .syntheticComponent ())
130
138
.findFirst ()
131
139
.orElse (null );
132
140
if (match != null ) {
133
- return match .measures ();
141
+ return match .liveMeasures ();
134
142
}
135
143
}
136
- return DoubleStream . empty () ;
144
+ return new double [ 0 ] ;
137
145
}
138
146
139
147
private static boolean targetComponentExistsAndIsRecorder (int component , RegisteredSyntheticComponent rsc ) {
You can’t perform that action at this time.
0 commit comments