diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-22 11:08:30 -0400 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-22 11:08:30 -0400 |
| commit | 1e68c15dfd99e85be1eecdd1c426a35c6b8a6cc5 (patch) | |
| tree | ef8642a15fb646e47fa5d9511db2812954e764aa | |
| parent | 70030c70da321f66f0be4508f76dc7ed1b43be4a (diff) | |
follow kernel API change: use fixed width fields
| -rw-r--r-- | include/timestamp.h | 16 | ||||
| -rw-r--r-- | src/ftcat.c | 10 | ||||
| -rw-r--r-- | src/timestamp.c | 6 |
3 files changed, 18 insertions, 14 deletions
diff --git a/include/timestamp.h b/include/timestamp.h index 7517bab..ec16d04 100644 --- a/include/timestamp.h +++ b/include/timestamp.h | |||
| @@ -1,15 +1,19 @@ | |||
| 1 | #ifndef TIMESTAMP_H | 1 | #ifndef TIMESTAMP_H |
| 2 | #define TIMESTAMP_H | 2 | #define TIMESTAMP_H |
| 3 | 3 | ||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 4 | struct timestamp { | 6 | struct timestamp { |
| 5 | unsigned long event; | 7 | uint64_t timestamp; |
| 6 | unsigned long long timestamp; | 8 | uint32_t seq_no; |
| 7 | unsigned int seq_no; | 9 | uint16_t cpu; |
| 8 | int cpu; | 10 | uint16_t event; |
| 9 | }; | 11 | }; |
| 10 | 12 | ||
| 11 | int str2event(const char* str, unsigned long *id); | 13 | typedef uint32_t cmd_t; |
| 12 | const char* event2str(unsigned long id); | 14 | |
| 15 | int str2event(const char* str, cmd_t *id); | ||
| 16 | const char* event2str(cmd_t id); | ||
| 13 | 17 | ||
| 14 | #define ENABLE_CMD 0L | 18 | #define ENABLE_CMD 0L |
| 15 | #define DISABLE_CMD 1L | 19 | #define DISABLE_CMD 1L |
diff --git a/src/ftcat.c b/src/ftcat.c index 0afba87..b317cba 100644 --- a/src/ftcat.c +++ b/src/ftcat.c | |||
| @@ -11,14 +11,14 @@ | |||
| 11 | 11 | ||
| 12 | static int fd; | 12 | static int fd; |
| 13 | static int event_count = 1; | 13 | static int event_count = 1; |
| 14 | static unsigned long ids[MAX_EVENTS]; | 14 | static cmd_t ids[MAX_EVENTS]; |
| 15 | 15 | ||
| 16 | static int disable_all(int fd) | 16 | static int disable_all(int fd) |
| 17 | { | 17 | { |
| 18 | int ret, size; | 18 | int ret, size; |
| 19 | ids[0] = DISABLE_CMD; | 19 | ids[0] = DISABLE_CMD; |
| 20 | fprintf(stderr, "Disabling %d events.\n", event_count - 1); | 20 | fprintf(stderr, "Disabling %d events.\n", event_count - 1); |
| 21 | size = event_count * sizeof(long); | 21 | size = event_count * sizeof(cmd_t); |
| 22 | ret = write(fd, ids, size); | 22 | ret = write(fd, ids, size); |
| 23 | //fprintf(stderr, "write = %d, meant to write %d (%m)\n", ret, size); | 23 | //fprintf(stderr, "write = %d, meant to write %d (%m)\n", ret, size); |
| 24 | return size == ret; | 24 | return size == ret; |
| @@ -26,8 +26,8 @@ static int disable_all(int fd) | |||
| 26 | 26 | ||
| 27 | static int enable_events(int fd, char* str) | 27 | static int enable_events(int fd, char* str) |
| 28 | { | 28 | { |
| 29 | unsigned long *id; | 29 | cmd_t *id; |
| 30 | unsigned long cmd[3]; | 30 | cmd_t cmd[3]; |
| 31 | 31 | ||
| 32 | id = ids + event_count; | 32 | id = ids + event_count; |
| 33 | if (!str2event(str, id)) | 33 | if (!str2event(str, id)) |
| @@ -38,7 +38,7 @@ static int enable_events(int fd, char* str) | |||
| 38 | cmd[0] = ENABLE_CMD; | 38 | cmd[0] = ENABLE_CMD; |
| 39 | cmd[1] = id[0]; | 39 | cmd[1] = id[0]; |
| 40 | cmd[2] = id[1]; | 40 | cmd[2] = id[1]; |
| 41 | return write(fd, cmd, 3 * sizeof(long)) == 3 * sizeof(long); | 41 | return write(fd, cmd, 3 * sizeof(cmd_t)) == 3 * sizeof(cmd_t); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | 44 | ||
diff --git a/src/timestamp.c b/src/timestamp.c index b495603..1df252a 100644 --- a/src/timestamp.c +++ b/src/timestamp.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | struct event_name { | 5 | struct event_name { |
| 6 | const char* name; | 6 | const char* name; |
| 7 | unsigned long id; | 7 | cmd_t id; |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | #define EVENT(name) {#name, TS_ ## name ## _START} | 10 | #define EVENT(name) {#name, TS_ ## name ## _START} |
| @@ -37,7 +37,7 @@ static struct event_name event_table[] = | |||
| 37 | EVENT(SRPT) | 37 | EVENT(SRPT) |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | int str2event(const char* str, unsigned long *id) | 40 | int str2event(const char* str, cmd_t *id) |
| 41 | { | 41 | { |
| 42 | int i; | 42 | int i; |
| 43 | 43 | ||
| @@ -49,7 +49,7 @@ int str2event(const char* str, unsigned long *id) | |||
| 49 | return 0; | 49 | return 0; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | const char* event2str(unsigned long id) | 52 | const char* event2str(cmd_t id) |
| 53 | { | 53 | { |
| 54 | int i; | 54 | int i; |
| 55 | 55 | ||
