Changeset 1edd6d0 in mainline for uspace/app/perf/ipc/ping_pong.c


Ignore:
Timestamp:
2018-11-17T00:53:52Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e131833c
Parents:
af2d3e3
Message:

Add separate IPC test service. Keep ns_ping for now for the sake of comparison.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/perf/ipc/ping_pong.c

    raf2d3e3 r1edd6d0  
    3131#include <stdlib.h>
    3232#include <time.h>
    33 #include <ns.h>
     33#include <ipc_test.h>
    3434#include <async.h>
    3535#include <errno.h>
     
    3939#define NUM_SAMPLES 10
    4040
    41 static errno_t ping_pong_measure(uint64_t niter, uint64_t *rduration)
     41static errno_t ping_pong_measure(ipc_test_t *test, uint64_t niter,
     42    uint64_t *rduration)
    4243{
    4344        struct timespec start;
     
    4748
    4849        for (count = 0; count < niter; count++) {
    49                 errno_t retval = ns_ping();
     50                errno_t retval = ipc_test_ping(test);
    5051
    5152                if (retval != EOK) {
     
    7980        uint64_t duration;
    8081        uint64_t dsmp[NUM_SAMPLES];
     82        ipc_test_t *test;
     83        const char *msg;
    8184
    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
    8390        printf("Warm up and determine work size...\n");
    8491
     
    8996
    9097        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                }
    94103
    95104                ping_pong_report(niter, duration);
     
    106115
    107116        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                }
    111122
    112123                ping_pong_report(niter, dsmp[i]);
     
    132143            avg, stddev, NUM_SAMPLES);
    133144
     145        ipc_test_destroy(test);
    134146        return NULL;
     147error:
     148        ipc_test_destroy(test);
     149        return msg;
    135150}
Note: See TracChangeset for help on using the changeset viewer.