193 static jlong elapsed_counter(); |
191 static jlong elapsed_counter(); |
194 static jlong elapsed_frequency(); |
192 static jlong elapsed_frequency(); |
195 |
193 |
196 // The "virtual time" of a thread is the amount of time a thread has |
194 // The "virtual time" of a thread is the amount of time a thread has |
197 // actually run. The first function indicates whether the OS supports |
195 // actually run. The first function indicates whether the OS supports |
198 // this functionality for the current thread, and if so: |
196 // this functionality for the current thread, and if so the second |
199 // * the second enables vtime tracking (if that is required). |
197 // returns the elapsed virtual time for the current thread. |
200 // * the third tells whether vtime is enabled. |
|
201 // * the fourth returns the elapsed virtual time for the current |
|
202 // thread. |
|
203 static bool supports_vtime(); |
198 static bool supports_vtime(); |
204 static bool enable_vtime(); |
|
205 static bool vtime_enabled(); |
|
206 static double elapsedVTime(); |
199 static double elapsedVTime(); |
207 |
200 |
208 // Return current local time in a string (YYYY-MM-DD HH:MM:SS). |
201 // Return current local time in a string (YYYY-MM-DD HH:MM:SS). |
209 // It is MT safe, but not async-safe, as reading time zone |
202 // It is MT safe, but not async-safe, as reading time zone |
210 // information may require a lock on some platforms. |
203 // information may require a lock on some platforms. |
252 static int initial_active_processor_count() { |
245 static int initial_active_processor_count() { |
253 assert(_initial_active_processor_count > 0, "Initial active processor count not set yet."); |
246 assert(_initial_active_processor_count > 0, "Initial active processor count not set yet."); |
254 return _initial_active_processor_count; |
247 return _initial_active_processor_count; |
255 } |
248 } |
256 |
249 |
257 // Bind processes to processors. |
|
258 // This is a two step procedure: |
|
259 // first you generate a distribution of processes to processors, |
|
260 // then you bind processes according to that distribution. |
|
261 // Compute a distribution for number of processes to processors. |
|
262 // Stores the processor id's into the distribution array argument. |
|
263 // Returns true if it worked, false if it didn't. |
|
264 static bool distribute_processes(uint length, uint* distribution); |
|
265 // Binds the current process to a processor. |
250 // Binds the current process to a processor. |
266 // Returns true if it worked, false if it didn't. |
251 // Returns true if it worked, false if it didn't. |
267 static bool bind_to_processor(uint processor_id); |
252 static bool bind_to_processor(uint processor_id); |
268 |
253 |
269 // Give a name to the current thread. |
254 // Give a name to the current thread. |
494 static size_t current_stack_size(); |
479 static size_t current_stack_size(); |
495 |
480 |
496 static void verify_stack_alignment() PRODUCT_RETURN; |
481 static void verify_stack_alignment() PRODUCT_RETURN; |
497 |
482 |
498 static bool message_box(const char* title, const char* message); |
483 static bool message_box(const char* title, const char* message); |
499 static char* do_you_want_to_debug(const char* message); |
|
500 |
484 |
501 // run cmd in a separate process and return its exit code; or -1 on failures |
485 // run cmd in a separate process and return its exit code; or -1 on failures |
502 static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); |
486 static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); |
503 |
487 |
504 // Call ::exit() on all platforms but Windows |
488 // Call ::exit() on all platforms but Windows |
518 // be called if something has gone badly wrong. CreateCoredumpOnCrash |
502 // be called if something has gone badly wrong. CreateCoredumpOnCrash |
519 // is intentionally not honored by this function. |
503 // is intentionally not honored by this function. |
520 static void die(); |
504 static void die(); |
521 |
505 |
522 // File i/o operations |
506 // File i/o operations |
523 static const int default_file_open_flags(); |
|
524 static int open(const char *path, int oflag, int mode); |
507 static int open(const char *path, int oflag, int mode); |
525 static FILE* open(int fd, const char* mode); |
508 static FILE* open(int fd, const char* mode); |
526 static FILE* fopen(const char* path, const char* mode); |
509 static FILE* fopen(const char* path, const char* mode); |
527 static int close(int fd); |
510 static int close(int fd); |
528 static jlong lseek(int fd, jlong offset, int whence); |
511 static jlong lseek(int fd, jlong offset, int whence); |
665 // for EINVAL). |
648 // for EINVAL). |
666 // Will return "Unknown error" for an unknown errno value. |
649 // Will return "Unknown error" for an unknown errno value. |
667 // Will always return a valid string which is a static constant. |
650 // Will always return a valid string which is a static constant. |
668 // Will not change the value of errno. |
651 // Will not change the value of errno. |
669 static const char* errno_name(int e); |
652 static const char* errno_name(int e); |
670 |
|
671 // Determines whether the calling process is being debugged by a user-mode debugger. |
|
672 static bool is_debugger_attached(); |
|
673 |
653 |
674 // wait for a key press if PauseAtExit is set |
654 // wait for a key press if PauseAtExit is set |
675 static void wait_for_keypress_at_exit(void); |
655 static void wait_for_keypress_at_exit(void); |
676 |
656 |
677 // The following two functions are used by fatal error handler to trace |
657 // The following two functions are used by fatal error handler to trace |