summaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-06-12 23:07:53 +0200
committerJulius Bünger <buenger@mytum.de>2018-06-12 23:07:53 +0200
commit8503c6fa26449228fa691c1dedfe3ca1a8d0b9ba (patch)
treef9828ab046ad048263c1040f8aa463ea7837d4ca /src/rps/rps-test_util.c
parentf24f95b6664f5e1d2a8e3cd6d03c957b0d2efd74 (diff)
rps profiler: cleaned debug output
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r--src/rps/rps-test_util.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 64ef5b986..9a1dfe0d8 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -37,17 +37,6 @@
#ifdef TO_FILE
-#define B2B_PAT "%c%c%c%c%c%c%c%c"
-#define B2B(byte) \
- (byte & 0x80 ? '1' : '0'), \
- (byte & 0x40 ? '1' : '0'), \
- (byte & 0x20 ? '1' : '0'), \
- (byte & 0x10 ? '1' : '0'), \
- (byte & 0x08 ? '1' : '0'), \
- (byte & 0x04 ? '1' : '0'), \
- (byte & 0x02 ? '1' : '0'), \
- (byte & 0x01 ? '1' : '0')
-
#define min(x,y) ((x) > (y) ? (y) : (x))
/**
@@ -195,14 +184,6 @@ to_file_raw_unaligned (const char *file_name,
bits_needed/8);
// TODO what if no iteration happens?
unsigned size_buf_write = 0;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "num_bits_buf_unaligned: %u\n",
- num_bits_buf_unaligned);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "ua args: size_buf: %u, bits_needed: %u -> iter: %u\n",
- size_buf,
- bits_needed,
- bytes_iter);
buf_write[0] = buf_unaligned;
/* Iterate over input bytes */
for (unsigned i = 0; i < bytes_iter; i++)
@@ -243,53 +224,16 @@ to_file_raw_unaligned (const char *file_name,
{
num_bits_needed_iter = 8;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "number of bits needed in this iteration: %u\n",
- num_bits_needed_iter);
mask_bits_needed_iter = ((char) 1 << num_bits_needed_iter) - 1;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "mask needed bits (current iter): "B2B_PAT"\n",
- B2B(mask_bits_needed_iter));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Unaligned byte: "B2B_PAT" (%u bits)\n",
- B2B(buf_unaligned),
- num_bits_buf_unaligned);
byte_input = buf[i];
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "next whole input byte: "B2B_PAT"\n",
- B2B(byte_input));
byte_input &= mask_bits_needed_iter;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "input byte, needed bits: "B2B_PAT"\n",
- B2B(byte_input));
num_bits_to_align = 8 - num_bits_buf_unaligned;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "number of bits needed to align unaligned bit: %u\n",
- num_bits_to_align);
num_bits_to_move = min (num_bits_to_align, num_bits_needed_iter);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "number of bits of new byte to move: %u\n",
- num_bits_to_move);
mask_input_to_move = ((char) 1 << num_bits_to_move) - 1;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "mask of bits of new byte to take for moving: "B2B_PAT"\n",
- B2B(mask_input_to_move));
bits_to_move = byte_input & mask_input_to_move;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "masked bits of new byte to take for moving: "B2B_PAT"\n",
- B2B(bits_to_move));
distance_shift_bits = num_bits_buf_unaligned;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "distance needed to shift bits to their correct spot: %u\n",
- distance_shift_bits);
bits_moving = bits_to_move << distance_shift_bits;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "shifted, masked bits of new byte being moved: "B2B_PAT"\n",
- B2B(bits_moving));
byte_to_fill = buf_unaligned | bits_moving;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "byte being filled: "B2B_PAT"\n",
- B2B(byte_to_fill));
if (num_bits_buf_unaligned + num_bits_needed_iter > 8)
{
/* buf_unaligned was aligned by filling
@@ -299,22 +243,10 @@ to_file_raw_unaligned (const char *file_name,
/* store the leftover, unaligned bits in buffer */
mask_input_leftover = mask_bits_needed_iter & (~ mask_input_to_move);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "mask of leftover bits of new byte: "B2B_PAT"\n",
- B2B(mask_input_leftover));
byte_input_leftover = byte_input & mask_input_leftover;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "masked, leftover bits of new byte: "B2B_PAT"\n",
- B2B(byte_input_leftover));
num_bits_leftover = num_bits_needed_iter - num_bits_to_move;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "number of unaligned bits left: %u\n",
- num_bits_leftover);
num_bits_discard = 8 - num_bits_needed_iter;
byte_unaligned_new = byte_input_leftover >> num_bits_to_move;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "new unaligned byte: "B2B_PAT"\n",
- B2B(byte_unaligned_new));
buf_unaligned = byte_unaligned_new;
num_bits_buf_unaligned = num_bits_leftover % 8;
}
@@ -324,24 +256,6 @@ to_file_raw_unaligned (const char *file_name,
buf_unaligned = byte_to_fill;
num_bits_buf_unaligned = (num_bits_buf_unaligned + bits_needed) % 8;
}
- ///* Byte to be completed will consist of what is left in the unaligned
- // * byte and the rest of the input byte */
- //LOG (GNUNET_ERROR_TYPE_DEBUG,
- // "ua: %u - %x, %x << %u = %x\n",
- // i,
- // buf_unaligned,
- // num_bits_buf_unaligned,
- // (char) ((char) buf_unaligned << num_bits_buf_unaligned));
- //buf_write[i] = buf_write[i] |
- // (char) ((char) buf_unaligned << num_bits_buf_unaligned);
- //LOG (GNUNET_ERROR_TYPE_DEBUG,
- // "ua: %x\n",
- // buf_write[i]);
- //buf_unaligned = buf[i] >> num_bits_buf_unaligned;
- //LOG (GNUNET_ERROR_TYPE_DEBUG,
- // "ua: %x\n"
- // "---\n",
- // buf_unaligned);
}
to_file_raw (file_name, buf_write, size_buf_write);
LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");