From 707cb4bfb6e6e918dba16021ca0ae29671660d68 Mon Sep 17 00:00:00 2001 From: trz Date: Wed, 19 Oct 2005 14:32:25 +0000 Subject: switch to binary TIMESTAMP --- runtime/ChangeLog | 4 ++++ runtime/print.c | 8 +++----- runtime/stpd/ChangeLog | 6 ++++++ runtime/stpd/librelay.c | 8 ++++---- runtime/stpd/stp_dump.c | 4 ++-- runtime/stpd/stp_merge.c | 6 +++--- 6 files changed, 22 insertions(+), 14 deletions(-) (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index abe2e64c..c01b69d6 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2005-10-19 Tom Zanussi + + * print.c (_stp_print_flush): Switch to binary TIMESTAMP. + 2005-10-14 Tom Zanussi PR 1455 diff --git a/runtime/print.c b/runtime/print.c index 49040c2d..a66f074e 100644 --- a/runtime/print.c +++ b/runtime/print.c @@ -61,7 +61,7 @@ void _stp_print_flush (void) #else /* STP_RELAYFS */ /* size of timestamp, in bytes, including space */ -#define TIMESTAMP_SIZE 11 +#define TIMESTAMP_SIZE (sizeof(int)) #define STP_PRINT_BUF_START (TIMESTAMP_SIZE) /** Size of buffer, not including terminating NULL */ @@ -82,14 +82,12 @@ void _stp_print_flush (void) int cpu = smp_processor_id(); char *buf = &_stp_pbuf[cpu][0]; char *ptr = buf + STP_PRINT_BUF_START; - int ret, seq; + int ret; if (_stp_pbuf_len[cpu] == 0) return; - seq = _stp_seq_inc(); - scnprintf (buf, TIMESTAMP_SIZE, "%10d", seq); - buf[TIMESTAMP_SIZE - 1] = ' '; + *((int *)buf) = _stp_seq_inc(); ret = _stp_transport_write(buf, _stp_pbuf_len[cpu] + TIMESTAMP_SIZE + 1); if (unlikely(ret < 0)) { #if 0 diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog index aceee584..01a8ef18 100644 --- a/runtime/stpd/ChangeLog +++ b/runtime/stpd/ChangeLog @@ -1,3 +1,9 @@ +2005-10-19 Tom Zanussi + + * librelay.c (merge_output): Switch to binary TIMESTAMP. + * stp_dump.c (main): Switch to binary TIMESTAMP. + * stp_merge.c (main): Switch to binary TIMESTAMP. + 2005-10-14 Tom Zanussi PR 1476 diff --git a/runtime/stpd/librelay.c b/runtime/stpd/librelay.c index b884e91d..b173b5d5 100644 --- a/runtime/stpd/librelay.c +++ b/runtime/stpd/librelay.c @@ -506,8 +506,8 @@ int init_stp(const char *relay_filebase, int print_summary) } -/* length of timestamp in output field 0 - TODO: make binary, variable */ -#define TIMESTAMP_SIZE 11 +/* length of timestamp in output field 0 */ +#define TIMESTAMP_SIZE (sizeof(int)) /** * merge_output - merge per-cpu output @@ -530,7 +530,7 @@ static int merge_output(void) return -1; } if (fread (buf, TIMESTAMP_SIZE, 1, fp[i])) - num[i] = strtoul (buf, NULL, 10); + num[i] = *((int *)buf); else num[i] = 0; } @@ -567,7 +567,7 @@ static int merge_output(void) } if (fread (buf, TIMESTAMP_SIZE, 1, fp[j])) - num[j] = strtoul (buf, NULL, 10); + num[j] = *((int *)buf); else num[j] = 0; } while (min); diff --git a/runtime/stpd/stp_dump.c b/runtime/stpd/stp_dump.c index 287d915c..5923a2e1 100644 --- a/runtime/stpd/stp_dump.c +++ b/runtime/stpd/stp_dump.c @@ -31,7 +31,7 @@ static void usage (char *prog) exit(1); } -#define TIMESTAMP_SIZE 11 +#define TIMESTAMP_SIZE (sizeof(int)) int main (int argc, char *argv[]) { @@ -53,7 +53,7 @@ int main (int argc, char *argv[]) int numbytes = 0; if (fread (buf, TIMESTAMP_SIZE, 1, fp)) - seq = strtoul (buf, NULL, 10); + seq = *((int *)buf); else break; diff --git a/runtime/stpd/stp_merge.c b/runtime/stpd/stp_merge.c index ecd9b64a..14cb785b 100644 --- a/runtime/stpd/stp_merge.c +++ b/runtime/stpd/stp_merge.c @@ -31,7 +31,7 @@ static void usage (char *prog) exit(1); } -#define TIMESTAMP_SIZE 11 +#define TIMESTAMP_SIZE (sizeof(int)) #define NR_CPUS 256 int main (int argc, char *argv[]) @@ -64,7 +64,7 @@ int main (int argc, char *argv[]) return -1; } if (fread (buf, TIMESTAMP_SIZE, 1, fp[i])) - num[i] = strtoul (buf, NULL, 10); + num[i] = *((int *)buf); else num[i] = 0; i++; @@ -106,7 +106,7 @@ int main (int argc, char *argv[]) } if (fread (buf, TIMESTAMP_SIZE, 1, fp[j])) - num[j] = strtoul (buf, NULL, 10); + num[j] = *((int *)buf); else num[j] = 0; } while (min); -- cgit