MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / ARC_parse_params

Function ARC_parse_params

libCacheSim/cache/eviction/ARC.c:611–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611static void ARC_parse_params(cache_t *cache,
612 const char *cache_specific_params) {
613 ARC_params_t *params = (ARC_params_t *)(cache->eviction_params);
614
615 char *params_str = strdup(cache_specific_params);
616 char *old_params_str = params_str;
617
618 while (params_str != NULL && params_str[0] != '\0') {
619 /* different parameters are separated by comma,
620 * key and value are separated by = */
621 char *key = strsep((char **)&params_str, "=");
622 // char *value = strsep((char **)&params_str, ",");
623
624 // skip the white space
625 while (params_str != NULL && *params_str == ' ') {
626 params_str++;
627 }
628
629 if (strcasecmp(key, "print") == 0) {
630 printf("parameters: %s\n", ARC_current_params(params));
631 exit(0);
632 } else {
633 ERROR("%s does not have parameter %s\n", cache->cache_name, key);
634 exit(1);
635 }
636 }
637
638 free(old_params_str);
639}
640
641// ***********************************************************************
642// **** ****

Callers

nothing calls this directly

Calls 1

ARC_current_paramsFunction · 0.85

Tested by

no test coverage detected