1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
11 * <p>The value will be used as a key to indicate the type of memory usage
14 public enum MemoryUsageType
{
16 * Memory usage of all the mem-tables.
18 kMemTableTotal((byte) 0),
20 * Memory usage of those un-flushed mem-tables.
22 kMemTableUnFlushed((byte) 1),
24 * Memory usage of all the table readers.
26 kTableReadersTotal((byte) 2),
28 * Memory usage by Cache.
30 kCacheTotal((byte) 3),
32 * Max usage types - copied to keep 1:1 with native.
34 kNumUsageTypes((byte) 4);
37 * Returns the byte value of the enumerations value
39 * @return byte representation
41 public byte getValue() {
46 * <p>Get the MemoryUsageType enumeration value by
47 * passing the byte identifier to this method.</p>
49 * @param byteIdentifier of MemoryUsageType.
51 * @return MemoryUsageType instance.
53 * @throws IllegalArgumentException if the usage type for the byteIdentifier
56 public static MemoryUsageType
getMemoryUsageType(final byte byteIdentifier
) {
57 for (final MemoryUsageType memoryUsageType
: MemoryUsageType
.values()) {
58 if (memoryUsageType
.getValue() == byteIdentifier
) {
59 return memoryUsageType
;
63 throw new IllegalArgumentException(
64 "Illegal value provided for MemoryUsageType.");
67 MemoryUsageType(byte value
) {
71 private final byte value_
;