| 57 | } |
| 58 | |
| 59 | void* LemonIPCThread(void* n){ |
| 60 | long endpHandle = syscall(SYS_INTERFACE_CONNECT, "lemon.testservice/testif", 0, 0, 0, 0); |
| 61 | if(endpHandle <= 0){ |
| 62 | printf("Failed to connect to interface %s!", "lemon.testservice/testif"); |
| 63 | return nullptr; |
| 64 | } |
| 65 | |
| 66 | char buf[64]; |
| 67 | uint64_t id; |
| 68 | uint32_t size; |
| 69 | |
| 70 | avgTime = 0; |
| 71 | |
| 72 | for(int i = 0; i < msgCount; i++){ |
| 73 | long ret = syscall(SYS_ENDPOINT_DEQUEUE, endpHandle, &id, &size, buf, 0); |
| 74 | while(!ret){ |
| 75 | ret = syscall(SYS_ENDPOINT_DEQUEUE, endpHandle, &id, &size, buf, 0); |
| 76 | } |
| 77 | |
| 78 | if(ret <= 0){ |
| 79 | printf("Error on endpoint dequeue!\n"); |
| 80 | return nullptr; |
| 81 | } |
| 82 | |
| 83 | clock_gettime(CLOCK_BOOTTIME, &newTimer[i]); |
| 84 | } |
| 85 | |
| 86 | int low = newTimer[0] - timer[0]; |
| 87 | int high = 0; |
| 88 | for(int i = 0; i < msgCount; i++){ |
| 89 | int diff = (newTimer[i] - timer[i]); |
| 90 | if(diff / 1000 < low){ |
| 91 | low = diff / 1000; |
| 92 | } |
| 93 | |
| 94 | if(diff / 1000 > high){ |
| 95 | high = diff / 1000; |
| 96 | } |
| 97 | |
| 98 | avgTime += diff; |
| 99 | } |
| 100 | avgTime = avgTime / msgCount / 1000; |
| 101 | |
| 102 | printf("Recieved messagees: avg time: %ldus, low: %dus, high %dus\n", avgTime, low, high); |
| 103 | |
| 104 | return nullptr; |
| 105 | } |
| 106 | |
| 107 | pthread_t t1; |
| 108 | pthread_t t2; |
nothing calls this directly
no outgoing calls
no test coverage detected