File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
tools/testing/selftests/binder Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
#include <stdio.h>
2
+ #include <stdlib.h>
2
3
#include <stdint.h>
3
4
#include <string.h>
4
5
#include <stdalign.h>
@@ -52,14 +53,18 @@ static size_t handle_read(int fd, struct binder_write_read *b)
52
53
int main (int argc , char * * argv )
53
54
{
54
55
int ret ;
55
- size_t i ;
56
56
struct timespec begin , end ;
57
+ uint64_t iters = 1000000 ;
57
58
58
- if (argc != 2 ) {
59
- fprintf (stderr , "Usage: %s <binder-file-name>\n" , argv [0 ]);
59
+ if (argc != 2 && argc != 3 ) {
60
+ fprintf (stderr , "Usage: %s <binder-file-name> [iters]\n" ,
61
+ argv [0 ]);
60
62
return 1 ;
61
63
}
62
64
65
+ if (argc >= 3 )
66
+ iters = strtoull (argv [2 ], NULL , 10 );
67
+
63
68
int fd = open (argv [1 ], O_RDWR );
64
69
if (fd == -1 ) {
65
70
perror ("open" );
@@ -100,7 +105,7 @@ int main(int argc, char **argv)
100
105
to_write .addr = handle_read (fd , & b );
101
106
102
107
clock_gettime (CLOCK_MONOTONIC , & begin );
103
- for ( i = 0 ; i < 1000000 ; i ++ ) {
108
+ while ( iters -- ) {
104
109
b .read_consumed = 0 ;
105
110
b .write_consumed = 0 ;
106
111
ret = ioctl (fd , BINDER_WRITE_READ , & b );
You can’t perform that action at this time.
0 commit comments