aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorNick Barnes2012-10-30 08:43:39 +0000
committerNick Barnes2012-10-30 08:43:39 +0000
commit271b4f6e0abd1a76bd9dc57781f076b7658cbce1 (patch)
tree0e162237b250d918d67d8dfb1faebd144d517e01 /mps/code
parent7616ea7159cf88b8f977f1205b1157d517e462a3 (diff)
downloademacs-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.h2
-rw-r--r--mps/code/mps.h2
-rw-r--r--mps/code/mpsliban.c14
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> */
41typedef unsigned Serial; /* <design/type/#serial> */ 41typedef unsigned Serial; /* <design/type/#serial> */
42typedef Addr Ref; /* <design/type/#ref> */ 42typedef Addr Ref; /* <design/type/#ref> */
43typedef void *Pointer; /* <design/type/#pointer> */ 43typedef void *Pointer; /* <design/type/#pointer> */
44typedef unsigned long Clock; /* processor time */ 44typedef Word Clock; /* processor time */
45typedef MPS_T_ULONGEST ULongest; /* <design/type/#ulongest> */ 45typedef MPS_T_ULONGEST ULongest; /* <design/type/#ulongest> */
46 46
47typedef Word RefSet; /* design.mps.refset */ 47typedef 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) */
76typedef unsigned mps_rm_t; /* root mode (unsigned) */ 76typedef unsigned mps_rm_t; /* root mode (unsigned) */
77typedef unsigned mps_rank_t; /* ranks (unsigned) */ 77typedef unsigned mps_rank_t; /* ranks (unsigned) */
78typedef unsigned mps_message_type_t; /* message type (unsigned) */ 78typedef unsigned mps_message_type_t; /* message type (unsigned) */
79typedef unsigned long mps_clock_t; /* processor time */ 79typedef 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
42int mps_lib_get_EOF(void) 43int 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 */
96mps_clock_t mps_clock(void) 97mps_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
102mps_clock_t mps_clocks_per_sec(void) 107mps_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