소스 검색

Renamed bench_read/prog/erased -> bench_readed/proged/erased

Yes this isn't really correct english anymore, but these names avoid the
read/read ambiguity.
Christopher Haster 3 년 전
부모
커밋
296c5afea7
4개의 변경된 파일71개의 추가작업 그리고 71개의 파일을 삭제
  1. 20 20
      bd/lfs_emubd.c
  2. 6 6
      bd/lfs_emubd.h
  3. 22 22
      runners/bench_runner.c
  4. 23 23
      scripts/bench.py

+ 20 - 20
bd/lfs_emubd.c

@@ -125,8 +125,8 @@ int lfs_emubd_createcfg(const struct lfs_config *cfg, const char *path,
     memset(bd->blocks, 0, cfg->block_count * sizeof(lfs_emubd_block_t*));
 
     // setup testing things
-    bd->read = 0;
-    bd->prog = 0;
+    bd->readed = 0;
+    bd->proged = 0;
     bd->erased = 0;
     bd->power_cycles = bd->cfg->power_cycles;
     bd->disk = NULL;
@@ -249,7 +249,7 @@ int lfs_emubd_read(const struct lfs_config *cfg, lfs_block_t block,
     }   
 
     // track reads
-    bd->read += size;
+    bd->readed += size;
     if (bd->cfg->read_sleep) {
         int err = nanosleep(&(struct timespec){
                 .tv_sec=bd->cfg->read_sleep/1000000000,
@@ -331,7 +331,7 @@ int lfs_emubd_prog(const struct lfs_config *cfg, lfs_block_t block,
     }
 
     // track progs
-    bd->prog += size;
+    bd->proged += size;
     if (bd->cfg->prog_sleep) {
         int err = nanosleep(&(struct timespec){
                 .tv_sec=bd->cfg->prog_sleep/1000000000,
@@ -454,18 +454,18 @@ int lfs_emubd_sync(const struct lfs_config *cfg) {
 
 /// Additional extended API for driving test features ///
 
-lfs_emubd_sio_t lfs_emubd_getread(const struct lfs_config *cfg) {
-    LFS_EMUBD_TRACE("lfs_emubd_getread(%p)", (void*)cfg);
+lfs_emubd_sio_t lfs_emubd_getreaded(const struct lfs_config *cfg) {
+    LFS_EMUBD_TRACE("lfs_emubd_getreaded(%p)", (void*)cfg);
     lfs_emubd_t *bd = cfg->context;
-    LFS_EMUBD_TRACE("lfs_emubd_getread -> %"PRIu64, bd->read);
-    return bd->read;
+    LFS_EMUBD_TRACE("lfs_emubd_getreaded -> %"PRIu64, bd->readed);
+    return bd->readed;
 }
 
-lfs_emubd_sio_t lfs_emubd_getprog(const struct lfs_config *cfg) {
-    LFS_EMUBD_TRACE("lfs_emubd_getprog(%p)", (void*)cfg);
+lfs_emubd_sio_t lfs_emubd_getproged(const struct lfs_config *cfg) {
+    LFS_EMUBD_TRACE("lfs_emubd_getproged(%p)", (void*)cfg);
     lfs_emubd_t *bd = cfg->context;
-    LFS_EMUBD_TRACE("lfs_emubd_getprog -> %"PRIu64, bd->prog);
-    return bd->prog;
+    LFS_EMUBD_TRACE("lfs_emubd_getproged -> %"PRIu64, bd->proged);
+    return bd->proged;
 }
 
 lfs_emubd_sio_t lfs_emubd_geterased(const struct lfs_config *cfg) {
@@ -475,19 +475,19 @@ lfs_emubd_sio_t lfs_emubd_geterased(const struct lfs_config *cfg) {
     return bd->erased;
 }
 
-int lfs_emubd_setread(const struct lfs_config *cfg, lfs_emubd_io_t read) {
-    LFS_EMUBD_TRACE("lfs_emubd_setread(%p, %"PRIu64")", (void*)cfg, read);
+int lfs_emubd_setreaded(const struct lfs_config *cfg, lfs_emubd_io_t readed) {
+    LFS_EMUBD_TRACE("lfs_emubd_setreaded(%p, %"PRIu64")", (void*)cfg, readed);
     lfs_emubd_t *bd = cfg->context;
-    bd->read = read;
-    LFS_EMUBD_TRACE("lfs_emubd_setread -> %d", 0);
+    bd->readed = readed;
+    LFS_EMUBD_TRACE("lfs_emubd_setreaded -> %d", 0);
     return 0;
 }
 
-int lfs_emubd_setprog(const struct lfs_config *cfg, lfs_emubd_io_t prog) {
-    LFS_EMUBD_TRACE("lfs_emubd_setprog(%p, %"PRIu64")", (void*)cfg, prog);
+int lfs_emubd_setproged(const struct lfs_config *cfg, lfs_emubd_io_t proged) {
+    LFS_EMUBD_TRACE("lfs_emubd_setproged(%p, %"PRIu64")", (void*)cfg, proged);
     lfs_emubd_t *bd = cfg->context;
-    bd->prog = prog;
-    LFS_EMUBD_TRACE("lfs_emubd_setprog -> %d", 0);
+    bd->proged = proged;
+    LFS_EMUBD_TRACE("lfs_emubd_setproged -> %d", 0);
     return 0;
 }
 

+ 6 - 6
bd/lfs_emubd.h

@@ -136,8 +136,8 @@ typedef struct lfs_emubd {
     lfs_emubd_block_t **blocks;
 
     // some other test state
-    lfs_emubd_io_t read;
-    lfs_emubd_io_t prog;
+    lfs_emubd_io_t readed;
+    lfs_emubd_io_t proged;
     lfs_emubd_io_t erased;
     lfs_emubd_powercycles_t power_cycles;
     lfs_emubd_disk_t *disk;
@@ -182,19 +182,19 @@ int lfs_emubd_sync(const struct lfs_config *cfg);
 /// Additional extended API for driving test features ///
 
 // Get total amount of bytes read
-lfs_emubd_sio_t lfs_emubd_getread(const struct lfs_config *cfg);
+lfs_emubd_sio_t lfs_emubd_getreaded(const struct lfs_config *cfg);
 
 // Get total amount of bytes programmed
-lfs_emubd_sio_t lfs_emubd_getprog(const struct lfs_config *cfg);
+lfs_emubd_sio_t lfs_emubd_getproged(const struct lfs_config *cfg);
 
 // Get total amount of bytes erased
 lfs_emubd_sio_t lfs_emubd_geterased(const struct lfs_config *cfg);
 
 // Manually set amount of bytes read
-int lfs_emubd_setread(const struct lfs_config *cfg, lfs_emubd_io_t read);
+int lfs_emubd_setreaded(const struct lfs_config *cfg, lfs_emubd_io_t readed);
 
 // Manually set amount of bytes programmed
-int lfs_emubd_setprog(const struct lfs_config *cfg, lfs_emubd_io_t prog);
+int lfs_emubd_setproged(const struct lfs_config *cfg, lfs_emubd_io_t proged);
 
 // Manually set amount of bytes erased
 int lfs_emubd_seterased(const struct lfs_config *cfg, lfs_emubd_io_t erased);

+ 22 - 22
runners/bench_runner.c

@@ -464,47 +464,47 @@ void bench_trace(const char *fmt, ...) {
 
 // bench recording state
 static struct lfs_config *bench_cfg = NULL;
-static lfs_emubd_io_t bench_last_read = 0;
-static lfs_emubd_io_t bench_last_prog = 0;
+static lfs_emubd_io_t bench_last_readed = 0;
+static lfs_emubd_io_t bench_last_proged = 0;
 static lfs_emubd_io_t bench_last_erased = 0;
-lfs_emubd_io_t bench_read = 0;
-lfs_emubd_io_t bench_prog = 0;
+lfs_emubd_io_t bench_readed = 0;
+lfs_emubd_io_t bench_proged = 0;
 lfs_emubd_io_t bench_erased = 0;
 
 void bench_reset(void) {
-    bench_read = 0;
-    bench_prog = 0;
+    bench_readed = 0;
+    bench_proged = 0;
     bench_erased = 0;
-    bench_last_read = 0;
-    bench_last_prog = 0;
+    bench_last_readed = 0;
+    bench_last_proged = 0;
     bench_last_erased = 0;
 }
 
 void bench_start(void) {
     assert(bench_cfg);
-    lfs_emubd_sio_t read = lfs_emubd_getread(bench_cfg);
-    assert(read >= 0);
-    lfs_emubd_sio_t prog = lfs_emubd_getprog(bench_cfg);
-    assert(prog >= 0);
+    lfs_emubd_sio_t readed = lfs_emubd_getreaded(bench_cfg);
+    assert(readed >= 0);
+    lfs_emubd_sio_t proged = lfs_emubd_getproged(bench_cfg);
+    assert(proged >= 0);
     lfs_emubd_sio_t erased = lfs_emubd_geterased(bench_cfg);
     assert(erased >= 0);
 
-    bench_last_read = read;
-    bench_last_prog = prog;
+    bench_last_readed = readed;
+    bench_last_proged = proged;
     bench_last_erased = erased;
 }
 
 void bench_stop(void) {
     assert(bench_cfg);
-    lfs_emubd_sio_t read = lfs_emubd_getread(bench_cfg);
-    assert(read >= 0);
-    lfs_emubd_sio_t prog = lfs_emubd_getprog(bench_cfg);
-    assert(prog >= 0);
+    lfs_emubd_sio_t readed = lfs_emubd_getreaded(bench_cfg);
+    assert(readed >= 0);
+    lfs_emubd_sio_t proged = lfs_emubd_getproged(bench_cfg);
+    assert(proged >= 0);
     lfs_emubd_sio_t erased = lfs_emubd_geterased(bench_cfg);
     assert(erased >= 0);
 
-    bench_read += read - bench_last_read;
-    bench_prog += prog - bench_last_prog;
+    bench_readed += readed - bench_last_readed;
+    bench_proged += proged - bench_last_proged;
     bench_erased += erased - bench_last_erased;
 }
 
@@ -1250,8 +1250,8 @@ void perm_run(
     printf("finished ");
     perm_printid(suite, case_);
     printf(" %"PRIu64" %"PRIu64" %"PRIu64,
-        bench_read,
-        bench_prog,
+        bench_readed,
+        bench_proged,
         bench_erased);
     printf("\n");
 

+ 23 - 23
scripts/bench.py

@@ -741,8 +741,8 @@ def run_stage(name, runner_, ids, output_, **args):
     passed_suite_perms = co.defaultdict(lambda: 0)
     passed_case_perms = co.defaultdict(lambda: 0)
     passed_perms = 0
-    read = 0
-    prog = 0
+    readed = 0
+    proged = 0
     erased = 0
     failures = []
     killed = False
@@ -750,8 +750,8 @@ def run_stage(name, runner_, ids, output_, **args):
     pattern = re.compile('^(?:'
             '(?P<op>running|finished|skipped|powerloss)'
                 ' (?P<id>(?P<case>[^:]+)[^\s]*)'
-                '(?: (?P<read>\d+))?'
-                '(?: (?P<prog>\d+))?'
+                '(?: (?P<readed>\d+))?'
+                '(?: (?P<proged>\d+))?'
                 '(?: (?P<erased>\d+))?'
             '|' '(?P<path>[^:]+):(?P<lineno>\d+):(?P<op_>assert):'
                 ' *(?P<message>.*)'
@@ -763,8 +763,8 @@ def run_stage(name, runner_, ids, output_, **args):
         nonlocal passed_suite_perms
         nonlocal passed_case_perms
         nonlocal passed_perms
-        nonlocal read
-        nonlocal prog
+        nonlocal readed
+        nonlocal proged
         nonlocal erased
         nonlocal locals
 
@@ -821,14 +821,14 @@ def run_stage(name, runner_, ids, output_, **args):
                     elif op == 'finished':
                         case = m.group('case')
                         suite = case_suites[case]
-                        read_ = int(m.group('read'))
-                        prog_ = int(m.group('prog'))
+                        readed_ = int(m.group('readed'))
+                        proged_ = int(m.group('proged'))
                         erased_ = int(m.group('erased'))
                         passed_suite_perms[suite] += 1
                         passed_case_perms[case] += 1
                         passed_perms += 1
-                        read += read_
-                        prog += prog_
+                        readed += readed_
+                        proged += proged_
                         erased += erased_
                         if output_:
                             # get defines and write to csv
@@ -837,8 +837,8 @@ def run_stage(name, runner_, ids, output_, **args):
                             output_.writerow({
                                 'suite': suite,
                                 'case': case,
-                                'bench_read': read_,
-                                'bench_prog': prog_,
+                                'bench_readed': readed_,
+                                'bench_proged': proged_,
                                 'bench_erased': erased_,
                                 **defines})
                     elif op == 'skipped':
@@ -980,8 +980,8 @@ def run_stage(name, runner_, ids, output_, **args):
     return (
         expected_perms,
         passed_perms,
-        read,
-        prog,
+        readed,
+        proged,
         erased,
         failures,
         killed)
@@ -1018,7 +1018,7 @@ def run(runner, bench_ids=[], **args):
     if args.get('output'):
         output = BenchOutput(args['output'],
             ['suite', 'case'],
-            ['bench_read', 'bench_prog', 'bench_erased'])
+            ['bench_readed', 'bench_proged', 'bench_erased'])
 
     # measure runtime
     start = time.time()
@@ -1026,8 +1026,8 @@ def run(runner, bench_ids=[], **args):
     # spawn runners
     expected = 0
     passed = 0
-    read = 0
-    prog = 0
+    readed = 0
+    proged = 0
     erased = 0
     failures = []
     for by in (expected_case_perms.keys() if args.get('by_cases')
@@ -1036,8 +1036,8 @@ def run(runner, bench_ids=[], **args):
         # spawn jobs for stage
         (expected_,
             passed_,
-            read_,
-            prog_,
+            readed_,
+            proged_,
             erased_,
             failures_,
             killed) = run_stage(
@@ -1049,8 +1049,8 @@ def run(runner, bench_ids=[], **args):
         # collect passes/failures
         expected += expected_
         passed += passed_
-        read += read_
-        prog += prog_
+        readed += readed_
+        proged += proged_
         erased += erased_
         failures.extend(failures_)
         if (failures and not args.get('keep_going')) or killed:
@@ -1072,8 +1072,8 @@ def run(runner, bench_ids=[], **args):
             if args['color'] else '',
         '\x1b[m' if args['color'] else '',
         ', '.join(filter(None, [
-            '%d read' % read,
-            '%d prog' % prog,
+            '%d readed' % readed,
+            '%d proged' % proged,
             '%d erased' % erased,
             'in %.2fs' % (stop-start)]))))
     print()