@ -29,6 +29,7 @@
# include <fcntl.h>
# include <algorithm>
# include <functional>
# include <string>
# include <Utils.h>
@ -36,7 +37,8 @@
namespace android {
namespace vold {
static status_t BenchmarkRun ( ) {
static status_t BenchmarkRun ( std : : function < bool ( int ) > checkpoint ) {
char * buf = ( char * ) malloc ( 1048576 ) ;
int t3433f17 = TEMP_FAILURE_RETRY ( open ( " file0 " , O_RDONLY | O_LARGEFILE ) ) ;
@ -277,6 +279,7 @@ TEMP_FAILURE_RETRY(pread(t3455f18, buf, 4096, 57012224)); // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f18 , buf , 1048576 , 0 ) ) ; // mmap2
close ( t3455f18 ) ;
t3455f18 = TEMP_FAILURE_RETRY ( open ( " file0 " , O_RDONLY | O_LARGEFILE ) ) ;
if ( ! checkpoint ( 52 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( read ( t3455f18 , buf , 4 ) ) ;
TEMP_FAILURE_RETRY ( lseek ( t3455f18 , 0 , SEEK_SET ) ) ;
TEMP_FAILURE_RETRY ( lseek ( t3455f18 , 0 , SEEK_END ) ) ;
@ -533,6 +536,7 @@ TEMP_FAILURE_RETRY(pread(t3483f25, buf, 4096, 184320));
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 69632 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 81920 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 90112 ) ) ;
if ( ! checkpoint ( 55 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 102400 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 114688 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3483f25 , buf , 4096 , 131072 ) ) ;
@ -776,6 +780,7 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 31, 32760741));
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 2073 , 32759808 ) ) ; // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 30 , 32273035 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 37 , 32273065 ) ) ;
if ( ! checkpoint ( 58 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 1692 , 32272384 ) ) ; // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 30 , 34612102 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 38 , 34612132 ) ) ;
@ -1001,6 +1006,7 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35474138));
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 43 , 35474168 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 3682 , 35471360 ) ) ; // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 30 , 34394223 ) ) ;
if ( ! checkpoint ( 61 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 41 , 34394253 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 481 , 34394112 ) ) ; // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 30 , 32648704 ) ) ;
@ -1223,6 +1229,7 @@ TEMP_FAILURE_RETRY(pwrite(t3499f40, buf, 4096, 8724));
TEMP_FAILURE_RETRY ( pwrite ( t3499f40 , buf , 4 , 12820 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f40 , buf , 4 , 12824 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f40 , buf , 4096 , 12828 ) ) ;
if ( ! checkpoint ( 64 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f40 , buf , 4 , 16924 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3499f40 , buf , 8 , 17408 ) ) ;
TEMP_FAILURE_RETRY ( fdatasync ( t3499f40 ) ) ;
@ -1452,6 +1459,7 @@ t3455f50 = TEMP_FAILURE_RETRY(open("file36", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
TEMP_FAILURE_RETRY ( pread ( t3455f50 , buf , 52 , 0 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f50 , buf , 4096 , 0 ) ) ; // mmap2
TEMP_FAILURE_RETRY ( pread ( t3455f50 , buf , 187587 , 0 ) ) ; // mmap2
if ( ! checkpoint ( 67 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3455f50 , buf , 4128 , 188416 ) ) ; // mmap2
close ( t3455f50 ) ;
t3455f50 = TEMP_FAILURE_RETRY ( open ( " file24 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
@ -1696,6 +1704,7 @@ TEMP_FAILURE_RETRY(read(t3532f53, buf, 16384));
close ( t3519f43 ) ;
close ( t3532f53 ) ;
int t3492f57 = TEMP_FAILURE_RETRY ( open ( " file54 " , O_RDONLY | O_LARGEFILE ) ) ;
if ( ! checkpoint ( 70 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( read ( t3492f57 , buf , 39938 ) ) ;
close ( t3492f57 ) ;
int t3492f61 = TEMP_FAILURE_RETRY ( open ( " file55 " , O_RDONLY | O_LARGEFILE ) ) ;
@ -1928,6 +1937,7 @@ TEMP_FAILURE_RETRY(pwrite(t3499f55, buf, 512, 0));
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4 , 512 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4096 , 516 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4 , 4612 ) ) ;
if ( ! checkpoint ( 73 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4 , 4616 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4096 , 4620 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f55 , buf , 4 , 8716 ) ) ;
@ -2159,6 +2169,7 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34267550));
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 49 , 34267580 ) ) ;
close ( t3499f73 ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f66 , buf , 12 , 0 ) ) ;
if ( ! checkpoint ( 76 ) ) return - 1 ;
close ( t3532f68 ) ;
TEMP_FAILURE_RETRY ( fdatasync ( t3499f66 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 722 , 34267136 ) ) ; // mmap2
@ -2396,6 +2407,7 @@ close(t3519f67);
t3519f67 = TEMP_FAILURE_RETRY ( open ( " file123 " , O_RDONLY | O_LARGEFILE | O_DIRECTORY | O_CLOEXEC ) ) ;
close ( t3519f67 ) ;
t3519f67 = TEMP_FAILURE_RETRY ( open ( " file124 " , O_RDONLY | O_LARGEFILE | O_DIRECTORY | O_CLOEXEC ) ) ;
if ( ! checkpoint ( 79 ) ) return - 1 ;
close ( t3519f67 ) ;
t3519f67 = TEMP_FAILURE_RETRY ( open ( " file125 " , O_RDONLY | O_LARGEFILE | O_DIRECTORY | O_CLOEXEC ) ) ;
close ( t3519f67 ) ;
@ -2620,6 +2632,7 @@ TEMP_FAILURE_RETRY(fdatasync(t3499f90));
TEMP_FAILURE_RETRY ( pwrite ( t3499f90 , buf , 28 , 0 ) ) ;
TEMP_FAILURE_RETRY ( fdatasync ( t3499f90 ) ) ;
close ( t3499f90 ) ;
if ( ! checkpoint ( 82 ) ) return - 1 ;
t3499f90 = TEMP_FAILURE_RETRY ( open ( " file18 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3499f90 , buf , 1 , 0 ) ) ;
close ( t3499f90 ) ;
@ -2838,6 +2851,7 @@ TEMP_FAILURE_RETRY(pread(t3505f66, buf, 1, 0));
close ( t3505f66 ) ;
t3505f66 = TEMP_FAILURE_RETRY ( open ( " file31 " , O_RDWR | O_CREAT | O_LARGEFILE | O_CLOEXEC , 0660 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3505f66 , buf , 512 , 0 ) ) ;
if ( ! checkpoint ( 85 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pwrite ( t3505f66 , buf , 4 , 512 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3505f66 , buf , 4096 , 516 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3505f66 , buf , 4 , 4612 ) ) ;
@ -3066,6 +3080,7 @@ TEMP_FAILURE_RETRY(pread(t3505f96, buf, 16, 24));
t3499f90 = TEMP_FAILURE_RETRY ( open ( " file18 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3499f90 , buf , 1 , 0 ) ) ;
close ( t3499f90 ) ;
if ( ! checkpoint ( 88 ) ) return - 1 ;
t3499f90 = TEMP_FAILURE_RETRY ( open ( " file18 " , O_RDWR | O_CREAT | O_LARGEFILE | O_CLOEXEC , 0660 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f90 , buf , 512 , 0 ) ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f90 , buf , 4 , 512 ) ) ;
@ -3278,6 +3293,7 @@ TEMP_FAILURE_RETRY(fdatasync(t3499f100));
close ( t3499f100 ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 30 , 35636928 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 60 , 35636958 ) ) ;
if ( ! checkpoint ( 91 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3455f17 , buf , 2062 , 35635200 ) ) ; // mmap2
t3499f84 = TEMP_FAILURE_RETRY ( open ( " file18 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3499f84 , buf , 1 , 0 ) ) ;
@ -3514,6 +3530,7 @@ TEMP_FAILURE_RETRY(pread(t3499f26, buf, 8, 13312));
TEMP_FAILURE_RETRY ( fdatasync ( t3499f26 ) ) ;
t3499f97 = TEMP_FAILURE_RETRY ( open ( " file22 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
TEMP_FAILURE_RETRY ( fdatasync ( t3499f97 ) ) ;
if ( ! checkpoint ( 93 ) ) return - 1 ;
close ( t3499f97 ) ;
TEMP_FAILURE_RETRY ( pwrite ( t3499f26 , buf , 12 , 0 ) ) ;
TEMP_FAILURE_RETRY ( fdatasync ( t3499f26 ) ) ;
@ -3760,6 +3777,7 @@ close(t3533f90);
t3526f90 = TEMP_FAILURE_RETRY ( open ( " file162 " , O_RDONLY | O_LARGEFILE ) ) ;
TEMP_FAILURE_RETRY ( read ( t3526f90 , buf , 16384 ) ) ;
TEMP_FAILURE_RETRY ( read ( t3526f90 , buf , 16384 ) ) ;
if ( ! checkpoint ( 96 ) ) return - 1 ;
close ( t3526f90 ) ;
t3526f90 = TEMP_FAILURE_RETRY ( open ( " file163 " , O_RDONLY | O_LARGEFILE ) ) ;
TEMP_FAILURE_RETRY ( read ( t3526f90 , buf , 16384 ) ) ;
@ -3994,6 +4012,7 @@ TEMP_FAILURE_RETRY(pread(t3597f110, buf, 1, 0));
close ( t3597f110 ) ;
TEMP_FAILURE_RETRY ( pread ( t3597f108 , buf , 16 , 24 ) ) ;
close ( t3540f109 ) ;
if ( ! checkpoint ( 99 ) ) return - 1 ;
TEMP_FAILURE_RETRY ( pread ( t3597f108 , buf , 4096 , 16384 ) ) ;
TEMP_FAILURE_RETRY ( pread ( t3597f108 , buf , 4096 , 12288 ) ) ;
t3597f109 = TEMP_FAILURE_RETRY ( open ( " file178 " , O_RDONLY | O_LARGEFILE | O_CLOEXEC ) ) ;
@ -4054,7 +4073,7 @@ static status_t CreateFile(const char* name, int len) {
return OK ;
}
static status_t BenchmarkCreate ( ) {
static status_t BenchmarkCreate ( std : : function < bool ( int ) > checkpoint ) {
status_t res = 0 ;
res | = CreateFile ( " stub " , 0 ) ;
@ -4069,6 +4088,7 @@ res |= CreateFile("file175", 9);
res | = CreateFile ( " file76 " , 0 ) ;
res | = CreateFile ( " file140 " , 4042 ) ;
res | = CreateFile ( " file80 " , 0 ) ;
if ( ! checkpoint ( 3 ) ) return - 1 ;
res | = CreateFile ( " file139 " , 49152 ) ;
res | = CreateFile ( " file50 " , 32768 ) ;
res | = CreateFile ( " file179 " , 4000 ) ;
@ -4081,6 +4101,7 @@ res |= CreateFile("file53", 32768);
res | = CreateFile ( " file72 " , 0 ) ;
res | = CreateFile ( " file55 " , 16384 ) ;
res | = CreateFile ( " file54 " , 39938 ) ;
if ( ! checkpoint ( 6 ) ) return - 1 ;
res | = CreateFile ( " file129 " , 3974 ) ;
res | = CreateFile ( " file107 " , 0 ) ;
res | = CreateFile ( " file95 " , 0 ) ;
@ -4093,6 +4114,7 @@ res |= CreateFile("file89", 0);
res | = CreateFile ( " file40 " , 4172 ) ;
res | = CreateFile ( " file20 " , 1 ) ;
res | = CreateFile ( " file151 " , 499712 ) ;
if ( ! checkpoint ( 10 ) ) return - 1 ;
res | = CreateFile ( " file106 " , 0 ) ;
res | = CreateFile ( " file159 " , 9 ) ;
res | = CreateFile ( " file47 " , 32768 ) ;
@ -4105,6 +4127,7 @@ res |= CreateFile("file172", 9);
res | = CreateFile ( " file148 " , 3461 ) ;
res | = CreateFile ( " file7 " , 794976 ) ;
res | = CreateFile ( " file68 " , 32768 ) ;
if ( ! checkpoint ( 13 ) ) return - 1 ;
res | = CreateFile ( " file109 " , 0 ) ;
res | = CreateFile ( " file142 " , 5057 ) ;
res | = CreateFile ( " file147 " , 3834 ) ;
@ -4117,6 +4140,7 @@ res |= CreateFile("file105", 0);
res | = CreateFile ( " file79 " , 0 ) ;
res | = CreateFile ( " file65 " , 32768 ) ;
res | = CreateFile ( " file135 " , 21257 ) ;
if ( ! checkpoint ( 16 ) ) return - 1 ;
res | = CreateFile ( " file124 " , 0 ) ;
res | = CreateFile ( " file87 " , 0 ) ;
res | = CreateFile ( " file64 " , 49152 ) ;
@ -4129,6 +4153,7 @@ res |= CreateFile("file178", 1);
res | = CreateFile ( " file163 " , 32768 ) ;
res | = CreateFile ( " file67 " , 32768 ) ;
res | = CreateFile ( " file155 " , 21512 ) ;
if ( ! checkpoint ( 20 ) ) return - 1 ;
res | = CreateFile ( " file156 " , 9 ) ;
res | = CreateFile ( " file23 " , 28700 ) ;
res | = CreateFile ( " file61 " , 32768 ) ;
@ -4141,6 +4166,7 @@ res |= CreateFile("file24", 94220);
res | = CreateFile ( " file57 " , 32768 ) ;
res | = CreateFile ( " file104 " , 0 ) ;
res | = CreateFile ( " file113 " , 0 ) ;
if ( ! checkpoint ( 23 ) ) return - 1 ;
res | = CreateFile ( " file99 " , 0 ) ;
res | = CreateFile ( " file120 " , 0 ) ;
res | = CreateFile ( " file154 " , 73728 ) ;
@ -4153,6 +4179,7 @@ res |= CreateFile("file96", 0);
res | = CreateFile ( " file91 " , 0 ) ;
res | = CreateFile ( " file158 " , 1 ) ;
res | = CreateFile ( " file174 " , 1 ) ;
if ( ! checkpoint ( 26 ) ) return - 1 ;
res | = CreateFile ( " file48 " , 32768 ) ;
res | = CreateFile ( " file33 " , 32566 ) ;
res | = CreateFile ( " file83 " , 0 ) ;
@ -4165,6 +4192,7 @@ res |= CreateFile("file16", 31392);
res | = CreateFile ( " file164 " , 32768 ) ;
res | = CreateFile ( " file36 " , 192544 ) ;
res | = CreateFile ( " file6 " , 4636 ) ;
if ( ! checkpoint ( 30 ) ) return - 1 ;
res | = CreateFile ( " file10 " , 16484 ) ;
res | = CreateFile ( " file150 " , 10056 ) ;
res | = CreateFile ( " file62 " , 32768 ) ;
@ -4177,6 +4205,7 @@ res |= CreateFile("file100", 0);
res | = CreateFile ( " file103 " , 0 ) ;
res | = CreateFile ( " file26 " , 28676 ) ;
res | = CreateFile ( " file46 " , 32768 ) ;
if ( ! checkpoint ( 33 ) ) return - 1 ;
res | = CreateFile ( " file60 " , 32768 ) ;
res | = CreateFile ( " file162 " , 32768 ) ;
res | = CreateFile ( " file25 " , 32872 ) ;
@ -4189,6 +4218,7 @@ res |= CreateFile("file51", 32768);
res | = CreateFile ( " file37 " , 159752 ) ;
res | = CreateFile ( " file73 " , 0 ) ;
res | = CreateFile ( " file71 " , 32768 ) ;
if ( ! checkpoint ( 36 ) ) return - 1 ;
res | = CreateFile ( " file98 " , 0 ) ;
res | = CreateFile ( " file74 " , 0 ) ;
res | = CreateFile ( " file93 " , 0 ) ;
@ -4201,6 +4231,7 @@ res |= CreateFile("file136", 4199);
res | = CreateFile ( " file132 " , 23233 ) ;
res | = CreateFile ( " file92 " , 0 ) ;
res | = CreateFile ( " file11 " , 0 ) ;
if ( ! checkpoint ( 40 ) ) return - 1 ;
res | = CreateFile ( " file86 " , 0 ) ;
res | = CreateFile ( " file22 " , 0 ) ;
res | = CreateFile ( " file56 " , 16384 ) ;
@ -4213,6 +4244,7 @@ res |= CreateFile("file63", 49152);
res | = CreateFile ( " file116 " , 0 ) ;
res | = CreateFile ( " file29 " , 1035 ) ;
res | = CreateFile ( " file35 " , 118788 ) ;
if ( ! checkpoint ( 43 ) ) return - 1 ;
res | = CreateFile ( " file170 " , 24576 ) ;
res | = CreateFile ( " file30 " , 98304 ) ;
res | = CreateFile ( " file14 " , 0 ) ;
@ -4225,6 +4257,7 @@ res |= CreateFile("file18", 17416);
res | = CreateFile ( " file134 " , 15056 ) ;
res | = CreateFile ( " file31 " , 25608 ) ;
res | = CreateFile ( " file97 " , 0 ) ;
if ( ! checkpoint ( 46 ) ) return - 1 ;
res | = CreateFile ( " file84 " , 0 ) ;
res | = CreateFile ( " file114 " , 0 ) ;
res | = CreateFile ( " file88 " , 0 ) ;
@ -4237,6 +4270,7 @@ res |= CreateFile("file133", 13332);
res | = CreateFile ( " file169 " , 11354 ) ;
res | = CreateFile ( " file166 " , 0 ) ;
res | = CreateFile ( " file49 " , 32768 ) ;
if ( ! checkpoint ( 50 ) ) return - 1 ;
res | = CreateFile ( " file177 " , 61440 ) ;
return res ;