| 54 | } |
| 55 | |
| 56 | static void PG_parse_init_params(const char *cache_specific_params, PG_init_params_t *init_params) { |
| 57 | char *params_str = strdup(cache_specific_params); |
| 58 | |
| 59 | while (params_str != NULL && params_str[0] != '\0') { |
| 60 | char *key = strsep((char **)¶ms_str, "="); |
| 61 | char *value = strsep((char **)¶ms_str, ","); |
| 62 | while (params_str != NULL && *params_str == ' ') { |
| 63 | params_str++; |
| 64 | } |
| 65 | if (strcasecmp(key, "lookahead-range") == 0) { |
| 66 | init_params->lookahead_range = atoi(value); |
| 67 | } else if (strcasecmp(key, "block-size") == 0) { |
| 68 | init_params->block_size = (unsigned long)atoi(value); |
| 69 | } else if (strcasecmp(key, "max-metadata-size") == 0) { |
| 70 | init_params->max_metadata_size = atof(value); |
| 71 | } else if (strcasecmp(key, "prefetch-threshold") == 0) { |
| 72 | init_params->prefetch_threshold = atof(value); |
| 73 | } else if (strcasecmp(key, "print") == 0 || strcasecmp(key, "default") == 0) { |
| 74 | printf("default params: %s\n", PG_default_params()); |
| 75 | exit(0); |
| 76 | } else { |
| 77 | ERROR("pg does not have parameter %s\n", key); |
| 78 | printf("default params: %s\n", PG_default_params()); |
| 79 | exit(1); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | static void set_PG_params(PG_params_t *PG_params, PG_init_params_t *init_params, uint64_t cache_size) { |
| 85 | PG_params->lookahead_range = init_params->lookahead_range; |
no test coverage detected