File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ const expect = chai.expect;
44
55module . exports = {
66 name : 'stat intensive 1' ,
7- description : 'create 10 directories and 100 subdirectories in each, then stat them intensively ' ,
7+ description : 'create 10 directories and 1000 subdirectories in each, then stat them over and over ' ,
88 do : async t => {
99 console . log ( 'stat intensive 1' ) ;
1010
1111 const dir_count = 10 ;
12- const subdir_count = 100 ;
12+ const subdir_count = 1000 ;
1313
1414 // key: uuid
1515 // value: path
@@ -23,12 +23,15 @@ module.exports = {
2323 }
2424 }
2525
26+ const start = Date . now ( ) ;
2627 for ( let i = 0 ; i < 10 ; i ++ ) {
2728 for ( const [ uuid , path ] of Object . entries ( dirs ) ) {
2829 const stat = await t . stat_uuid ( uuid ) ;
2930 expect ( stat . is_dir ) . equal ( true ) ;
3031 expect ( stat . path ) . equal ( path ) ;
3132 }
3233 }
34+ const duration = Date . now ( ) - start ;
35+ return { duration } ;
3336 }
3437} ;
Original file line number Diff line number Diff line change @@ -94,14 +94,23 @@ module.exports = class TestSDK {
9494
9595 this . nameStack . push ( benchDefinition . name ) ;
9696 const start = Date . now ( ) ;
97+ let duration = null ;
9798 try {
98- await benchDefinition . do ( this ) ;
99+ const res = await benchDefinition . do ( this ) ;
100+ if ( res ?. duration ) {
101+ duration = res . duration ;
102+ }
99103 } catch ( e ) {
100104 // we don't tolerate errors at the moment
101105 console . error ( e ) ;
102106 throw e ;
103107 }
104108
109+ if ( ! duration ) {
110+ // if the bench definition doesn't return the duration, we calculate it here
111+ duration = Date . now ( ) - start ;
112+ }
113+
105114 const results = {
106115 name : benchDefinition . name ,
107116 description : benchDefinition . description ,
You can’t perform that action at this time.
0 commit comments