"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core-cache.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

core-cache.c  (stress-ng-0.12.09.tar.xz):core-cache.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 366 skipping to change at line 366
#endif #endif
#if defined(AT_L3_CACHESIZE) #if defined(AT_L3_CACHESIZE)
{ AT_L3_CACHESIZE, CACHE_TYPE_UNIFIED, 2, CACHE_SIZE, 3 }, { AT_L3_CACHESIZE, CACHE_TYPE_UNIFIED, 2, CACHE_SIZE, 3 },
#endif #endif
}; };
const size_t count = 4; const size_t count = 4;
size_t i; size_t i;
bool valid = false; bool valid = false;
cpu->caches = calloc(count, sizeof(stress_cpu_cache_t)); cpu->caches = calloc(count, sizeof(*(cpu->caches)));
if (!cpu->caches) { if (!cpu->caches) {
pr_err("failed to allocate %zu bytes for cpu caches\n", pr_err("failed to allocate %zu bytes for cpu caches\n",
count * sizeof(stress_cpu_cache_t)); count * sizeof(*(cpu->caches)));
return 0; return 0;
} }
for (i = 0; i < SIZEOF_ARRAY(cache_auxval_info); i++) { for (i = 0; i < SIZEOF_ARRAY(cache_auxval_info); i++) {
const uint64_t value = getauxval(cache_auxval_info[i].auxval_type ); const uint64_t value = getauxval(cache_auxval_info[i].auxval_type );
const size_t index = cache_auxval_info[i].index; const size_t index = cache_auxval_info[i].index;
if (value) if (value)
valid = true; valid = true;
skipping to change at line 445 skipping to change at line 445
{ "l1_icache_line_size", CACHE_TYPE_INSTRUCTION, 1, CACHE_ LINE_SIZE, 1 }, { "l1_icache_line_size", CACHE_TYPE_INSTRUCTION, 1, CACHE_ LINE_SIZE, 1 },
{ "l1_icache_size", CACHE_TYPE_INSTRUCTION, 1, CACHE_ SIZE, 1 }, { "l1_icache_size", CACHE_TYPE_INSTRUCTION, 1, CACHE_ SIZE, 1 },
{ "l2_cache_line_size", CACHE_TYPE_UNIFIED, 2, CACHE_ LINE_SIZE, 2 }, { "l2_cache_line_size", CACHE_TYPE_UNIFIED, 2, CACHE_ LINE_SIZE, 2 },
{ "l2_cache_size", CACHE_TYPE_UNIFIED, 2, CACHE_ SIZE, 2 }, { "l2_cache_size", CACHE_TYPE_UNIFIED, 2, CACHE_ SIZE, 2 },
}; };
const size_t count = 3; const size_t count = 3;
size_t i; size_t i;
bool valid = false; bool valid = false;
cpu->caches = calloc(count, sizeof(stress_cpu_cache_t)); cpu->caches = calloc(count, sizeof(*(cpu->caches)));
if (!cpu->caches) { if (!cpu->caches) {
pr_err("failed to allocate %zu bytes for cpu caches\n", pr_err("failed to allocate %zu bytes for cpu caches\n",
count * sizeof(stress_cpu_cache_t)); count * sizeof(*(cpu->caches)));
return 0; return 0;
} }
for (i = 0; i < SIZEOF_ARRAY(cache_info); i++) { for (i = 0; i < SIZEOF_ARRAY(cache_info); i++) {
const size_t index = cache_info[i].index; const size_t index = cache_info[i].index;
uint64_t value; uint64_t value;
if (stress_get_cpu_cache_value(cpu_path, cache_info[i].filename, &value) < 0) if (stress_get_cpu_cache_value(cpu_path, cache_info[i].filename, &value) < 0)
continue; continue;
skipping to change at line 555 skipping to change at line 555
const size_t cpu_path_len = strlen(cpu_path); const size_t cpu_path_len = strlen(cpu_path);
char path[cpu_path_len + 128]; char path[cpu_path_len + 128];
(void)stress_mk_filename(path, sizeof(path), cpu_path, SYS_CPU_CACHE_DIR) ; (void)stress_mk_filename(path, sizeof(path), cpu_path, SYS_CPU_CACHE_DIR) ;
n = scandir(path, &namelist, index_filter, index_sort); n = scandir(path, &namelist, index_filter, index_sort);
if (n <= 0) { if (n <= 0) {
cpu->caches = NULL; cpu->caches = NULL;
return 0; return 0;
} }
cpu->cache_count = (uint32_t)n; cpu->cache_count = (uint32_t)n;
cpu->caches = calloc(cpu->cache_count, sizeof(stress_cpu_cache_t)); cpu->caches = calloc(cpu->cache_count, sizeof(*(cpu->caches)));
if (!cpu->caches) { if (!cpu->caches) {
size_t cache_bytes = cpu->cache_count * sizeof(stress_cpu_cache_t ); size_t cache_bytes = cpu->cache_count * sizeof(*(cpu->caches));
pr_err("failed to allocate %zu bytes for cpu caches\n", pr_err("failed to allocate %zu bytes for cpu caches\n",
cache_bytes); cache_bytes);
cpu->caches = NULL; cpu->caches = NULL;
cpu->cache_count = 0; cpu->cache_count = 0;
goto list_free; goto list_free;
} }
for (i = 0; i < cpu->cache_count; i++) { for (i = 0; i < cpu->cache_count; i++) {
skipping to change at line 639 skipping to change at line 639
{ {
int i, cpu_count; int i, cpu_count;
stress_cpus_t *cpus = NULL; stress_cpus_t *cpus = NULL;
struct dirent **namelist = NULL; struct dirent **namelist = NULL;
cpu_count = scandir(SYS_CPU_PREFIX, &namelist, cpu_filter, cpusort); cpu_count = scandir(SYS_CPU_PREFIX, &namelist, cpu_filter, cpusort);
if (cpu_count < 1) { if (cpu_count < 1) {
pr_err("no CPUs found in %s\n", SYS_CPU_PREFIX); pr_err("no CPUs found in %s\n", SYS_CPU_PREFIX);
goto out; goto out;
} }
cpus = calloc(1, sizeof(stress_cpus_t)); cpus = calloc(1, sizeof(*cpus));
if (!cpus) if (!cpus)
goto out; goto out;
cpus->cpus = calloc((size_t)cpu_count, sizeof(stress_cpu_t)); cpus->cpus = calloc((size_t)cpu_count, sizeof(*(cpus->cpus)));
if (!cpus->cpus) { if (!cpus->cpus) {
free(cpus); free(cpus);
cpus = NULL; cpus = NULL;
goto out; goto out;
} }
cpus->count = (uint32_t)cpu_count; cpus->count = (uint32_t)cpu_count;
for (i = 0; i < cpu_count; i++) { for (i = 0; i < cpu_count; i++) {
const char *name = namelist[i]->d_name; const char *name = namelist[i]->d_name;
const size_t fullpath_len = strlen(SYS_CPU_PREFIX) + strlen(name) + 2; const size_t fullpath_len = strlen(SYS_CPU_PREFIX) + strlen(name) + 2;
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)