diff options
| author | Nick Barnes | 2012-10-30 08:43:39 +0000 |
|---|---|---|
| committer | Nick Barnes | 2012-10-30 08:43:39 +0000 |
| commit | 271b4f6e0abd1a76bd9dc57781f076b7658cbce1 (patch) | |
| tree | 0e162237b250d918d67d8dfb1faebd144d517e01 /mps/code | |
| parent | 7616ea7159cf88b8f977f1205b1157d517e462a3 (diff) | |
| download | emacs-271b4f6e0abd1a76bd9dc57781f076b7658cbce1.tar.gz emacs-271b4f6e0abd1a76bd9dc57781f076b7658cbce1.zip | |
change mps_clock_t to word.
Copied from Perforce
Change: 180151
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/mpmtypes.h | 2 | ||||
| -rw-r--r-- | mps/code/mps.h | 2 | ||||
| -rw-r--r-- | mps/code/mpsliban.c | 14 |
3 files changed, 14 insertions, 4 deletions
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 984790baf56..f7cf9a023ea 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -41,7 +41,7 @@ typedef unsigned Shift; /* <design/type/#shift> */ | |||
| 41 | typedef unsigned Serial; /* <design/type/#serial> */ | 41 | typedef unsigned Serial; /* <design/type/#serial> */ |
| 42 | typedef Addr Ref; /* <design/type/#ref> */ | 42 | typedef Addr Ref; /* <design/type/#ref> */ |
| 43 | typedef void *Pointer; /* <design/type/#pointer> */ | 43 | typedef void *Pointer; /* <design/type/#pointer> */ |
| 44 | typedef unsigned long Clock; /* processor time */ | 44 | typedef Word Clock; /* processor time */ |
| 45 | typedef MPS_T_ULONGEST ULongest; /* <design/type/#ulongest> */ | 45 | typedef MPS_T_ULONGEST ULongest; /* <design/type/#ulongest> */ |
| 46 | 46 | ||
| 47 | typedef Word RefSet; /* design.mps.refset */ | 47 | typedef Word RefSet; /* design.mps.refset */ |
diff --git a/mps/code/mps.h b/mps/code/mps.h index 6d0edbb75d2..c3433aca1ce 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h | |||
| @@ -76,7 +76,7 @@ typedef size_t mps_align_t; /* alignment (size_t) */ | |||
| 76 | typedef unsigned mps_rm_t; /* root mode (unsigned) */ | 76 | typedef unsigned mps_rm_t; /* root mode (unsigned) */ |
| 77 | typedef unsigned mps_rank_t; /* ranks (unsigned) */ | 77 | typedef unsigned mps_rank_t; /* ranks (unsigned) */ |
| 78 | typedef unsigned mps_message_type_t; /* message type (unsigned) */ | 78 | typedef unsigned mps_message_type_t; /* message type (unsigned) */ |
| 79 | typedef unsigned long mps_clock_t; /* processor time */ | 79 | typedef mps_word_t mps_clock_t; /* processor time */ |
| 80 | 80 | ||
| 81 | /* Result Codes */ | 81 | /* Result Codes */ |
| 82 | /* .result-codes: Keep in sync with <code/mpmtypes.h#result-codes> */ | 82 | /* .result-codes: Keep in sync with <code/mpmtypes.h#result-codes> */ |
diff --git a/mps/code/mpsliban.c b/mps/code/mpsliban.c index 654615a9919..98a5f6ce91c 100644 --- a/mps/code/mpsliban.c +++ b/mps/code/mpsliban.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <stdio.h> | 37 | #include <stdio.h> |
| 38 | #include <string.h> | 38 | #include <string.h> |
| 39 | #include <ctype.h> | 39 | #include <ctype.h> |
| 40 | #include <assert.h> | ||
| 40 | 41 | ||
| 41 | 42 | ||
| 42 | int mps_lib_get_EOF(void) | 43 | int mps_lib_get_EOF(void) |
| @@ -95,13 +96,22 @@ int (mps_lib_memcmp)(const void *s1, const void *s2, size_t n) | |||
| 95 | /* See http://devworld.apple.com/dev/techsupport/insidemac/OSUtilities/OSUtilities-94.html#MARKER-9-32 */ | 96 | /* See http://devworld.apple.com/dev/techsupport/insidemac/OSUtilities/OSUtilities-94.html#MARKER-9-32 */ |
| 96 | mps_clock_t mps_clock(void) | 97 | mps_clock_t mps_clock(void) |
| 97 | { | 98 | { |
| 98 | return (unsigned long)clock(); | 99 | /* The clock values need to fit in mps_clock_t. If your platform |
| 100 | has a very wide clock type, trim or truncate it. */ | ||
| 101 | assert(sizeof(mps_clock_t) >= sizeof(clock_t)); | ||
| 102 | |||
| 103 | return (mps_clock_t)clock(); | ||
| 99 | } | 104 | } |
| 100 | 105 | ||
| 101 | 106 | ||
| 102 | mps_clock_t mps_clocks_per_sec(void) | 107 | mps_clock_t mps_clocks_per_sec(void) |
| 103 | { | 108 | { |
| 104 | return (unsigned long)CLOCKS_PER_SEC; | 109 | /* The MPS needs at least a millisecond clock to get enough |
| 110 | resolution for telemetry tools. If your platform has a | ||
| 111 | floating point clock, multiply it up here in the plinth. */ | ||
| 112 | assert(CLOCKS_PER_SEC >= 1000); | ||
| 113 | |||
| 114 | return (mps_clock_t)CLOCKS_PER_SEC; | ||
| 105 | } | 115 | } |
| 106 | 116 | ||
| 107 | 117 | ||