Skip to content

Commit 553b5f2

Browse files
committed
Reformated cache_init.h using clang format
1 parent 04f24e0 commit 553b5f2

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

libCacheSim/bin/cachesim/cache_init.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
extern "C" {
1313
#endif
1414

15-
static inline cache_t *create_cache(const char *trace_path, const char *eviction_algo, const uint64_t cache_size,
16-
const char *eviction_params, const bool consider_obj_metadata) {
15+
static inline cache_t *create_cache(const char *trace_path,
16+
const char *eviction_algo,
17+
const uint64_t cache_size,
18+
const char *eviction_params,
19+
const bool consider_obj_metadata) {
1720
common_cache_params_t cc_params = {
18-
.cache_size = cache_size,
19-
.default_ttl = 86400 * 300,
20-
.hashpower = 24,
21-
.consider_obj_metadata = consider_obj_metadata,
22-
};
21+
.cache_size = cache_size,
22+
.default_ttl = 86400 * 300,
23+
.hashpower = 24,
24+
.consider_obj_metadata = consider_obj_metadata,
25+
};
2326
cache_t *cache;
2427

2528
/* the trace provided is small */
26-
if (trace_path != NULL && strstr(trace_path, "data/trace.") != NULL) cc_params.hashpower -= 8;
29+
if (trace_path != NULL && strstr(trace_path, "data/trace.") != NULL)
30+
cc_params.hashpower -= 8;
2731
typedef struct {
2832
const char *name;
2933
cache_t *(*init_func)(common_cache_params_t, const char *);
@@ -85,7 +89,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
8589
}
8690
}
8791

88-
// Initializing for algorithms which require special handling (not in simple_algos)
92+
// Initializing for algorithms which require special handling (not in
93+
// simple_algos)
8994
if (init_func) {
9095
cache = init_func(cc_params, eviction_params);
9196
} else if (strcasecmp(eviction_algo, "hyperbolic") == 0) {
@@ -104,7 +109,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
104109
cache = WTinyLFU_init(cc_params, eviction_params);
105110
}
106111
}
107-
} else if (strcasecmp(eviction_algo, "belady") == 0 && strcasestr(trace_path, "lcs") == NULL) {
112+
} else if (strcasecmp(eviction_algo, "belady") == 0 &&
113+
strcasestr(trace_path, "lcs") == NULL) {
108114
if (strcasestr(trace_path, "oracleGeneral") == NULL) {
109115
WARN("belady is only supported for oracleGeneral and lcs trace\n");
110116
WARN("to convert a trace to lcs format\n");
@@ -114,7 +120,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
114120
}
115121
cache = Belady_init(cc_params, eviction_params);
116122
} else if (strcasecmp(eviction_algo, "beladySize") == 0) {
117-
if (strcasestr(trace_path, "oracleGeneral") == NULL && strcasestr(trace_path, "lcs") == NULL) {
123+
if (strcasestr(trace_path, "oracleGeneral") == NULL &&
124+
strcasestr(trace_path, "lcs") == NULL) {
118125
WARN("beladySize is only supported for oracleGeneral and lcs trace\n");
119126
WARN("to convert a trace to lcs format\n");
120127
WARN("./bin/traceConv input_trace trace_format output_trace\n");
@@ -128,7 +135,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
128135
cache = ThreeLCache_init(cc_params, eviction_params);
129136
#endif
130137
#ifdef ENABLE_GLCACHE
131-
} else if (strcasecmp(eviction_algo, "GLCache") == 0 || strcasecmp(eviction_algo, "gl-cache") == 0) {
138+
} else if (strcasecmp(eviction_algo, "GLCache") == 0 ||
139+
strcasecmp(eviction_algo, "gl-cache") == 0) {
132140
cache = GLCache_init(cc_params, eviction_params);
133141
#endif
134142
#ifdef ENABLE_LRB

0 commit comments

Comments
 (0)