Skip to content

Commit c213bff

Browse files
authored
Merge pull request #84 from skrakau/test_usage_issue
Fix uc calculation and add warning
2 parents 3f3312b + f502187 commit c213bff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/nf-co2footprint/src/main/nextflow/co2footprint/CO2FootprintFactory.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ class CO2FootprintFactory implements TraceObserverFactory {
160160
cpu_usage = nc * 100
161161
}
162162
// TODO how to handle double, Double datatypes for ceiling?
163-
Double cpus_ceil = Math.ceil( cpu_usage / 100.0 as double )
164-
Double uc = cpu_usage / (100.0 * cpus_ceil) as Double
163+
if ( cpu_usage == 0.0 ) {
164+
warnings << "The reported CPU usage is 0.0 for at last one task!"
165+
}
166+
Double uc = cpu_usage / (100.0 * nc) as Double
165167

166168
/**
167169
* Factors of memory power usage

0 commit comments

Comments
 (0)