# flash-perf

## Directory

> eXtremeDB_rt/samples/flash-perf/

## Description

> "flash-perf" measures performance of insert, search, update operations atop of the flash simulator.

## Used API

> mco_system_get_current_time()

## Code snippet

>         printf("Random search        : "); fflush(stdout);
>         start_time = msec();
>         for (i = 0, key = seed; i < nRecords; i++, key = random_sequence(key)) {
>             CHECK(mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t));
>             CHECK(PRecord_pk_index_cursor(t, &c));
>             CHECK(PRecord_pk_search(t, &c, MCO_EQ, key));
>             CHECK(PRecord_from_cursor(t, &c, &rec));
>             CHECK(PRecord_value_get(&rec, &value));
>             if (value != i) {
>                 printf("Unexpected value %u (expected %u)\n", value, i);
>                 return MCO_NO;
>             }
>             CHECK(mco_trans_commit(t));
>             if (i % (nRecords / report_dot) == 0) {
>                 printf("."); fflush(stdout);
>             }
>         }
>         printf(" %d searches: %d milliseconds (%d microsecs/search)\n", nRecords,
>                 (int)(msec() - start_time), (int)(((msec() - start_time)* 1000) / nRecords));

## What to expect as an output

>     	Insert               : .................... 1000 objects: 12 milliseconds,(12 microsecs/object)
>     	Random search        : .................... 1000 searches: 1 milliseconds (1 microsecs/search)
>     	Sequential search    : .................... 1000 searches: 1 milliseconds (1 microsecs/search)
>     	Random update        : .................... 1000 objects: 12 milliseconds (12 microsecs/object)
>     	Sequential update    : .................... 1000 objects: 1 milliseconds (1 microsecs/object)
>     	Random delete        : .................... 1000 objects: 16 milliseconds (16 microsecs/object)
>     	------ FLASH statistic (image file <NULL>) ------
>     	FLASH reads                :       1559        2 Mb   (3 Mb by page)
>     	FLASH progs                :      16032       31 Mb
>     	FLASH erases               :        759       94 Mb
>     	FLASH copies               :      32528       63 Mb
>     	FLASH is_free              :          0
>     	FLASH is_bad               :       1315
>     	FLASH mark_bad             :          0
>     	FLASH syncs                :       3002
>     	FLASH time                 :          0
>     	Bad block map :
>     	...........
>     	0 bad blocks