634 //
635 // If user_sys_cpu_time is true, user+sys time is returned.
636 // Otherwise, only user time is returned
637 static jlong current_thread_cpu_time(bool user_sys_cpu_time);
638 static jlong thread_cpu_time(Thread* t, bool user_sys_cpu_time);
639
640 // Return a bunch of info about the timers.
641 // Note that the returned info for these two functions may be different
642 // on some platforms
643 static void current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
644 static void thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
645
646 static bool is_thread_cpu_time_supported();
647
648 // System loadavg support. Returns -1 if load average cannot be obtained.
649 static int loadavg(double loadavg[], int nelem);
650
651 // Hook for os specific jvm options that we don't want to abort on seeing
652 static bool obsolete_option(const JavaVMOption *option);
653
654 // Platform dependent stuff
655 #ifdef TARGET_OS_FAMILY_linux
656 # include "os_linux.hpp"
657 #endif
658 #ifdef TARGET_OS_FAMILY_solaris
659 # include "os_solaris.hpp"
660 #endif
661 #ifdef TARGET_OS_FAMILY_windows
662 # include "os_windows.hpp"
663 #endif
664 #ifdef TARGET_OS_ARCH_linux_x86
665 # include "os_linux_x86.hpp"
666 #endif
667 #ifdef TARGET_OS_ARCH_linux_sparc
668 # include "os_linux_sparc.hpp"
669 #endif
670 #ifdef TARGET_OS_ARCH_linux_zero
671 # include "os_linux_zero.hpp"
672 #endif
673 #ifdef TARGET_OS_ARCH_solaris_x86
701 // Void return because it's a hint and can fail.
702 static void hint_no_preempt();
703
704 // Used at creation if requested by the diagnostic flag PauseAtStartup.
705 // Causes the VM to wait until an external stimulus has been applied
706 // (for Unix, that stimulus is a signal, for Windows, an external
707 // ResumeThread call)
708 static void pause();
709
710 protected:
711 static long _rand_seed; // seed for random number generator
712 static int _processor_count; // number of processors
713
714 static char* format_boot_path(const char* format_string,
715 const char* home,
716 int home_len,
717 char fileSep,
718 char pathSep);
719 static bool set_boot_path(char fileSep, char pathSep);
720 static char** split_path(const char* path, int* n);
721 };
722
723 // Note that "PAUSE" is almost always used with synchronization
724 // so arguably we should provide Atomic::SpinPause() instead
725 // of the global SpinPause() with C linkage.
726 // It'd also be eligible for inlining on many platforms.
727
728 extern "C" int SpinPause () ;
729 extern "C" int SafeFetch32 (int * adr, int errValue) ;
730 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t errValue) ;
731
732 #endif // SHARE_VM_RUNTIME_OS_HPP
|
634 //
635 // If user_sys_cpu_time is true, user+sys time is returned.
636 // Otherwise, only user time is returned
637 static jlong current_thread_cpu_time(bool user_sys_cpu_time);
638 static jlong thread_cpu_time(Thread* t, bool user_sys_cpu_time);
639
640 // Return a bunch of info about the timers.
641 // Note that the returned info for these two functions may be different
642 // on some platforms
643 static void current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
644 static void thread_cpu_time_info(jvmtiTimerInfo *info_ptr);
645
646 static bool is_thread_cpu_time_supported();
647
648 // System loadavg support. Returns -1 if load average cannot be obtained.
649 static int loadavg(double loadavg[], int nelem);
650
651 // Hook for os specific jvm options that we don't want to abort on seeing
652 static bool obsolete_option(const JavaVMOption *option);
653
654 // Read file line by line. If line is longer than bsize,
655 // rest of line is skipped. Returns number of bytes read or -1 on eof
656 static int get_line_chars(int fd, char *buf, size_t bsize);
657
658 // Platform dependent stuff
659 #ifdef TARGET_OS_FAMILY_linux
660 # include "os_linux.hpp"
661 #endif
662 #ifdef TARGET_OS_FAMILY_solaris
663 # include "os_solaris.hpp"
664 #endif
665 #ifdef TARGET_OS_FAMILY_windows
666 # include "os_windows.hpp"
667 #endif
668 #ifdef TARGET_OS_ARCH_linux_x86
669 # include "os_linux_x86.hpp"
670 #endif
671 #ifdef TARGET_OS_ARCH_linux_sparc
672 # include "os_linux_sparc.hpp"
673 #endif
674 #ifdef TARGET_OS_ARCH_linux_zero
675 # include "os_linux_zero.hpp"
676 #endif
677 #ifdef TARGET_OS_ARCH_solaris_x86
705 // Void return because it's a hint and can fail.
706 static void hint_no_preempt();
707
708 // Used at creation if requested by the diagnostic flag PauseAtStartup.
709 // Causes the VM to wait until an external stimulus has been applied
710 // (for Unix, that stimulus is a signal, for Windows, an external
711 // ResumeThread call)
712 static void pause();
713
714 protected:
715 static long _rand_seed; // seed for random number generator
716 static int _processor_count; // number of processors
717
718 static char* format_boot_path(const char* format_string,
719 const char* home,
720 int home_len,
721 char fileSep,
722 char pathSep);
723 static bool set_boot_path(char fileSep, char pathSep);
724 static char** split_path(const char* path, int* n);
725
726
727 };
728
729 // Note that "PAUSE" is almost always used with synchronization
730 // so arguably we should provide Atomic::SpinPause() instead
731 // of the global SpinPause() with C linkage.
732 // It'd also be eligible for inlining on many platforms.
733
734 extern "C" int SpinPause () ;
735 extern "C" int SafeFetch32 (int * adr, int errValue) ;
736 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t errValue) ;
737
738 #endif // SHARE_VM_RUNTIME_OS_HPP
|