Changeset e7f9a09 in mainline for uspace/app/hbench/malloc/malloc2.c
- Timestamp:
- 2019-01-21T13:20:31Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d17cf8c
- Parents:
- 94ebebf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hbench/malloc/malloc2.c
r94ebebf re7f9a09 35 35 #include "../hbench.h" 36 36 37 static bool runner(benchmeter_t *meter, uint64_t niter, 38 char *error, size_t error_size) 37 static bool runner(bench_run_t *run, uint64_t niter) 39 38 { 40 bench meter_start(meter);39 bench_run_start(run); 41 40 42 41 void **p = malloc(niter * sizeof(void *)); 43 42 if (p == NULL) { 44 snprintf(error, error_size, 45 "failed to allocate backend array (%" PRIu64 "B)", 43 return bench_run_fail(run, "failed to allocate backend array (%" PRIu64 "B)", 46 44 niter * sizeof(void *)); 47 return false;48 45 } 49 46 … … 51 48 p[count] = malloc(1); 52 49 if (p[count] == NULL) { 53 snprintf(error, error_size,54 "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")",55 count, niter);56 50 for (uint64_t j = 0; j < count; j++) { 57 51 free(p[j]); 58 52 } 59 53 free(p); 60 return false; 54 return bench_run_fail(run, 55 "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")", 56 count, niter); 61 57 } 62 58 } … … 67 63 free(p); 68 64 69 bench meter_stop(meter);65 bench_run_stop(run); 70 66 71 67 return true;
Note:
See TracChangeset
for help on using the changeset viewer.