Changeset 1edd6d0 in mainline for uspace/app/perf/ipc/ping_pong.c
- Timestamp:
- 2018-11-17T00:53:52Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e131833c
- Parents:
- af2d3e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/perf/ipc/ping_pong.c
raf2d3e3 r1edd6d0 31 31 #include <stdlib.h> 32 32 #include <time.h> 33 #include < ns.h>33 #include <ipc_test.h> 34 34 #include <async.h> 35 35 #include <errno.h> … … 39 39 #define NUM_SAMPLES 10 40 40 41 static errno_t ping_pong_measure(uint64_t niter, uint64_t *rduration) 41 static errno_t ping_pong_measure(ipc_test_t *test, uint64_t niter, 42 uint64_t *rduration) 42 43 { 43 44 struct timespec start; … … 47 48 48 49 for (count = 0; count < niter; count++) { 49 errno_t retval = ns_ping();50 errno_t retval = ipc_test_ping(test); 50 51 51 52 if (retval != EOK) { … … 79 80 uint64_t duration; 80 81 uint64_t dsmp[NUM_SAMPLES]; 82 ipc_test_t *test; 83 const char *msg; 81 84 82 printf("Benchmark ns server ping time\n"); 85 printf("Benchmark IPC test server ping time\n"); 86 rc = ipc_test_create(&test); 87 if (rc != EOK) 88 return "Failed contacting IPC test server."; 89 83 90 printf("Warm up and determine work size...\n"); 84 91 … … 89 96 90 97 while (true) { 91 rc = ping_pong_measure(niter, &duration); 92 if (rc != EOK) 93 return "Failed."; 98 rc = ping_pong_measure(test, niter, &duration); 99 if (rc != EOK) { 100 msg = "Failed."; 101 goto error; 102 } 94 103 95 104 ping_pong_report(niter, duration); … … 106 115 107 116 for (i = 0; i < NUM_SAMPLES; i++) { 108 rc = ping_pong_measure(niter, &dsmp[i]); 109 if (rc != EOK) 110 return "Failed."; 117 rc = ping_pong_measure(test, niter, &dsmp[i]); 118 if (rc != EOK) { 119 msg = "Failed."; 120 goto error; 121 } 111 122 112 123 ping_pong_report(niter, dsmp[i]); … … 132 143 avg, stddev, NUM_SAMPLES); 133 144 145 ipc_test_destroy(test); 134 146 return NULL; 147 error: 148 ipc_test_destroy(test); 149 return msg; 135 150 }
Note:
See TracChangeset
for help on using the changeset viewer.