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. |
496 static size_t current_stack_size(); |
481 static size_t current_stack_size(); |
497 |
482 |
498 static void verify_stack_alignment() PRODUCT_RETURN; |
483 static void verify_stack_alignment() PRODUCT_RETURN; |
499 |
484 |
500 static bool message_box(const char* title, const char* message); |
485 static bool message_box(const char* title, const char* message); |
501 static char* do_you_want_to_debug(const char* message); |
|
502 |
486 |
503 // run cmd in a separate process and return its exit code; or -1 on failures |
487 // run cmd in a separate process and return its exit code; or -1 on failures |
504 static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); |
488 static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); |
505 |
489 |
506 // Call ::exit() on all platforms but Windows |
490 // Call ::exit() on all platforms but Windows |
520 // be called if something has gone badly wrong. CreateCoredumpOnCrash |
504 // be called if something has gone badly wrong. CreateCoredumpOnCrash |
521 // is intentionally not honored by this function. |
505 // is intentionally not honored by this function. |
522 static void die(); |
506 static void die(); |
523 |
507 |
524 // File i/o operations |
508 // File i/o operations |
525 static const int default_file_open_flags(); |
|
526 static int open(const char *path, int oflag, int mode); |
509 static int open(const char *path, int oflag, int mode); |
527 static FILE* open(int fd, const char* mode); |
510 static FILE* open(int fd, const char* mode); |
528 static FILE* fopen(const char* path, const char* mode); |
511 static FILE* fopen(const char* path, const char* mode); |
529 static int close(int fd); |
512 static int close(int fd); |
530 static jlong lseek(int fd, jlong offset, int whence); |
513 static jlong lseek(int fd, jlong offset, int whence); |
667 // for EINVAL). |
650 // for EINVAL). |
668 // Will return "Unknown error" for an unknown errno value. |
651 // Will return "Unknown error" for an unknown errno value. |
669 // Will always return a valid string which is a static constant. |
652 // Will always return a valid string which is a static constant. |
670 // Will not change the value of errno. |
653 // Will not change the value of errno. |
671 static const char* errno_name(int e); |
654 static const char* errno_name(int e); |
672 |
|
673 // Determines whether the calling process is being debugged by a user-mode debugger. |
|
674 static bool is_debugger_attached(); |
|
675 |
655 |
676 // wait for a key press if PauseAtExit is set |
656 // wait for a key press if PauseAtExit is set |
677 static void wait_for_keypress_at_exit(void); |
657 static void wait_for_keypress_at_exit(void); |
678 |
658 |
679 // The following two functions are used by fatal error handler to trace |
659 // The following two functions are used by fatal error handler to trace |