434 // applications that host the JVM directly may do so. Some platforms
435 // need special-case handling of the primordial thread if it attaches
436 // to the VM.
437 static bool is_primordial_thread(void)
438 #if defined(_WINDOWS) || defined(BSD)
439 // No way to identify the primordial thread.
440 { return false; }
441 #else
442 ;
443 #endif
444
445 static bool create_attached_thread(JavaThread* thread);
446 static void pd_start_thread(Thread* thread);
447 static void start_thread(Thread* thread);
448
449 // Returns true if successful.
450 static bool signal_thread(Thread* thread, int sig, const char* reason);
451
452 static void free_thread(OSThread* osthread);
453
454 // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit
455 static intx current_thread_id();
456 static int current_process_id();
457
458 // Short standalone OS sleep routines suitable for slow path spin loop.
459 // Ignores safepoints/suspension/Thread.interrupt() (so keep it short).
460 // ms/ns = 0, will sleep for the least amount of time allowed by the OS.
461 // Maximum sleep time is just under 1 second.
462 static void naked_short_sleep(jlong ms);
463 static void naked_short_nanosleep(jlong ns);
464 // Longer standalone OS sleep routine - a convenience wrapper around
465 // multiple calls to naked_short_sleep. Only for use by non-JavaThreads.
466 static void naked_sleep(jlong millis);
467 // Never returns, use with CAUTION
468 static void infinite_sleep();
469 static void naked_yield () ;
470 static OSReturn set_priority(Thread* thread, ThreadPriority priority);
471 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
472
473 static int pd_self_suspend_thread(Thread* thread);
474
761 static void init_random(unsigned int initval); // initialize random sequence
762
763 // Structured OS Exception support
764 static void os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread);
765
766 // On Posix compatible OS it will simply check core dump limits while on Windows
767 // it will check if dump file can be created. Check or prepare a core dump to be
768 // taken at a later point in the same thread in os::abort(). Use the caller
769 // provided buffer as a scratch buffer. The status message which will be written
770 // into the error log either is file location or a short error message, depending
771 // on the checking result.
772 static void check_dump_limit(char* buffer, size_t bufferSize);
773
774 // Get the default path to the core file
775 // Returns the length of the string
776 static int get_core_path(char* buffer, size_t bufferSize);
777
778 // JVMTI & JVM monitoring and management support
779 // The thread_cpu_time() and current_thread_cpu_time() are only
780 // supported if is_thread_cpu_time_supported() returns true.
781 // They are not supported on Solaris T1.
782
783 // Thread CPU Time - return the fast estimate on a platform
784 // On Solaris - call gethrvtime (fast) - user time only
785 // On Linux - fast clock_gettime where available - user+sys
786 // - otherwise: very slow /proc fs - user+sys
787 // On Windows - GetThreadTimes - user+sys
788 static jlong current_thread_cpu_time();
789 static jlong thread_cpu_time(Thread* t);
790
791 // Thread CPU Time with user_sys_cpu_time parameter.
792 //
793 // If user_sys_cpu_time is true, user+sys time is returned.
794 // Otherwise, only user time is returned
795 static jlong current_thread_cpu_time(bool user_sys_cpu_time);
796 static jlong thread_cpu_time(Thread* t, bool user_sys_cpu_time);
797
798 // Return a bunch of info about the timers.
799 // Note that the returned info for these two functions may be different
800 // on some platforms
801 static void current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
802 static void thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
803
804 static bool is_thread_cpu_time_supported();
|
434 // applications that host the JVM directly may do so. Some platforms
435 // need special-case handling of the primordial thread if it attaches
436 // to the VM.
437 static bool is_primordial_thread(void)
438 #if defined(_WINDOWS) || defined(BSD)
439 // No way to identify the primordial thread.
440 { return false; }
441 #else
442 ;
443 #endif
444
445 static bool create_attached_thread(JavaThread* thread);
446 static void pd_start_thread(Thread* thread);
447 static void start_thread(Thread* thread);
448
449 // Returns true if successful.
450 static bool signal_thread(Thread* thread, int sig, const char* reason);
451
452 static void free_thread(OSThread* osthread);
453
454 // thread id on Linux/64bit is 64bit, on Windows it's 32bit
455 static intx current_thread_id();
456 static int current_process_id();
457
458 // Short standalone OS sleep routines suitable for slow path spin loop.
459 // Ignores safepoints/suspension/Thread.interrupt() (so keep it short).
460 // ms/ns = 0, will sleep for the least amount of time allowed by the OS.
461 // Maximum sleep time is just under 1 second.
462 static void naked_short_sleep(jlong ms);
463 static void naked_short_nanosleep(jlong ns);
464 // Longer standalone OS sleep routine - a convenience wrapper around
465 // multiple calls to naked_short_sleep. Only for use by non-JavaThreads.
466 static void naked_sleep(jlong millis);
467 // Never returns, use with CAUTION
468 static void infinite_sleep();
469 static void naked_yield () ;
470 static OSReturn set_priority(Thread* thread, ThreadPriority priority);
471 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
472
473 static int pd_self_suspend_thread(Thread* thread);
474
761 static void init_random(unsigned int initval); // initialize random sequence
762
763 // Structured OS Exception support
764 static void os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread);
765
766 // On Posix compatible OS it will simply check core dump limits while on Windows
767 // it will check if dump file can be created. Check or prepare a core dump to be
768 // taken at a later point in the same thread in os::abort(). Use the caller
769 // provided buffer as a scratch buffer. The status message which will be written
770 // into the error log either is file location or a short error message, depending
771 // on the checking result.
772 static void check_dump_limit(char* buffer, size_t bufferSize);
773
774 // Get the default path to the core file
775 // Returns the length of the string
776 static int get_core_path(char* buffer, size_t bufferSize);
777
778 // JVMTI & JVM monitoring and management support
779 // The thread_cpu_time() and current_thread_cpu_time() are only
780 // supported if is_thread_cpu_time_supported() returns true.
781
782 // Thread CPU Time - return the fast estimate on a platform
783 // On Linux - fast clock_gettime where available - user+sys
784 // - otherwise: very slow /proc fs - user+sys
785 // On Windows - GetThreadTimes - user+sys
786 static jlong current_thread_cpu_time();
787 static jlong thread_cpu_time(Thread* t);
788
789 // Thread CPU Time with user_sys_cpu_time parameter.
790 //
791 // If user_sys_cpu_time is true, user+sys time is returned.
792 // Otherwise, only user time is returned
793 static jlong current_thread_cpu_time(bool user_sys_cpu_time);
794 static jlong thread_cpu_time(Thread* t, bool user_sys_cpu_time);
795
796 // Return a bunch of info about the timers.
797 // Note that the returned info for these two functions may be different
798 // on some platforms
799 static void current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
800 static void thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
801
802 static bool is_thread_cpu_time_supported();
|