forked from krzysztofslusarski/jvm-gc-logs-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor string deduplication and add spock (krzysztofslusarski#2)
* Refactor string deduplication and add spock * fixing dedup parser - version update, bytes parser * Add test to show no succeeding deduplication produces no stats Co-authored-by: Artur Owczarek <[email protected]> Co-authored-by: Ślusarski Krzysztof <[email protected]>
- Loading branch information
1 parent
c206e1b
commit ae69a82
Showing
11 changed files
with
294 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...er-commons/src/main/java/pl/ks/profiling/safepoint/analyzer/commons/shared/Consumer3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package pl.ks.profiling.safepoint.analyzer.commons.shared; | ||
|
||
@FunctionalInterface | ||
public interface Consumer3<T, U, V> { | ||
void apply(T t, U u, V v); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../pl/ks/profiling/safepoint/analyzer/commons/shared/stringdedup/parser/UnitsConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package pl.ks.profiling.safepoint.analyzer.commons.shared.stringdedup.parser; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.RoundingMode; | ||
|
||
class UnitsConverter { | ||
public static final BigDecimal KB_TO_MB_MULTIPLIER = new BigDecimal(1024); | ||
public static final BigDecimal KB_TO_GB_MULTIPLIER = KB_TO_MB_MULTIPLIER.multiply(KB_TO_MB_MULTIPLIER); | ||
public static final BigDecimal B_TO_KB_DIVISOR = new BigDecimal(1024); | ||
|
||
public static BigDecimal bytesToKiloBytes(BigDecimal bytes) { | ||
return bytes.divide(B_TO_KB_DIVISOR, 2, RoundingMode.HALF_EVEN); | ||
} | ||
|
||
public static BigDecimal megabytesToKiloBytes(BigDecimal megaBytes) { | ||
return megaBytes.multiply(KB_TO_MB_MULTIPLIER); | ||
} | ||
|
||
public static BigDecimal gigabytesToKiloBytes(BigDecimal gigaBytes) { | ||
return gigaBytes.multiply(KB_TO_GB_MULTIPLIER); | ||
} | ||
} |
Oops, something went wrong.