Changeset e7f9a09 in mainline for uspace/app/hbench/fs/fileread.c
- Timestamp:
- 2019-01-21T13:20:31Z (5 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/fs/fileread.c
r94ebebf re7f9a09 45 45 * corresponding blocks would be cached after first run. 46 46 */ 47 static bool runner(benchmeter_t *meter, uint64_t size, 48 char *error, size_t error_size) 47 static bool runner(bench_run_t *run, uint64_t size) 49 48 { 50 49 const char *path = bench_param_get("filename", "/data/web/helenos.png"); … … 52 51 char *buf = malloc(BUFFER_SIZE); 53 52 if (buf == NULL) { 54 snprintf(error, error_size, "failed to allocate %dB buffer", BUFFER_SIZE); 55 return false; 53 return bench_run_fail(run, "failed to allocate %dB buffer", BUFFER_SIZE); 56 54 } 57 55 … … 60 58 FILE *file = fopen(path, "r"); 61 59 if (file == NULL) { 62 snprintf(error, error_size, "failed to open %s for reading: %s",60 bench_run_fail(run, "failed to open %s for reading: %s", 63 61 path, str_error(errno)); 64 62 ret = false; … … 66 64 } 67 65 68 bench meter_start(meter);66 bench_run_start(run); 69 67 for (uint64_t i = 0; i < size; i++) { 70 68 int rc = fseek(file, 0, SEEK_SET); 71 69 if (rc != 0) { 72 snprintf(error, error_size, "failed to rewind %s: %s",70 bench_run_fail(run, "failed to rewind %s: %s", 73 71 path, str_error(errno)); 74 72 ret = false; … … 78 76 fread(buf, 1, BUFFER_SIZE, file); 79 77 if (ferror(file)) { 80 snprintf(error, error_size, "failed to read from %s: %s",78 bench_run_fail(run, "failed to read from %s: %s", 81 79 path, str_error(errno)); 82 80 ret = false; … … 85 83 } 86 84 } 87 bench meter_stop(meter);85 bench_run_stop(run); 88 86 89 87 leave_close:
Note:
See TracChangeset
for help on using the changeset viewer.