log buffers

This commit is contained in:
Quentin 2020-02-01 00:19:04 +01:00
parent f830d43458
commit c9c23331ca

View file

@ -5,6 +5,23 @@ void measure_parse(int size, struct measure_conf* mc) {
uint64_t micro_sec; uint64_t micro_sec;
if (size != mc->payload_size) { if (size != mc->payload_size) {
fprintf(stderr, "read size: %d, expected: %ld\n", size, mc->payload_size); fprintf(stderr, "read size: %d, expected: %ld\n", size, mc->payload_size);
int i;
fprintf(stderr, "received buffer:\n");
for (i = 0; i < mc->payload_size; i++) {
if (i > 0) fprintf(stderr, ":");
fprintf(stderr, "%02x", (unsigned char) mc->payload_rcv[i]);
}
fprintf(stderr, "\n");
fprintf(stderr, "local buffer (reference):\n");
for (i = 0; i < mc->payload_size; i++) {
if (i > 0) fprintf(stderr, ":");
fprintf(stderr, "%02X", (unsigned char) mc->payload[i]);
}
fprintf(stderr, "\n");
perror("read error, payload has wrong size"); perror("read error, payload has wrong size");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }