46 #include "prims/jvmtiCodeBlobEvents.hpp"
47 #include "prims/jvmtiExtensions.hpp"
48 #include "prims/jvmtiGetLoadedClasses.hpp"
49 #include "prims/jvmtiImpl.hpp"
50 #include "prims/jvmtiManageCapabilities.hpp"
51 #include "prims/jvmtiRawMonitor.hpp"
52 #include "prims/jvmtiRedefineClasses.hpp"
53 #include "prims/jvmtiTagMap.hpp"
54 #include "prims/jvmtiThreadState.inline.hpp"
55 #include "prims/jvmtiUtil.hpp"
56 #include "runtime/arguments.hpp"
57 #include "runtime/deoptimization.hpp"
58 #include "runtime/interfaceSupport.hpp"
59 #include "runtime/javaCalls.hpp"
60 #include "runtime/jfieldIDWorkaround.hpp"
61 #include "runtime/jniHandles.inline.hpp"
62 #include "runtime/osThread.hpp"
63 #include "runtime/reflectionUtils.hpp"
64 #include "runtime/signature.hpp"
65 #include "runtime/thread.inline.hpp"
66 #include "runtime/threadSMR.hpp"
67 #include "runtime/timerTrace.hpp"
68 #include "runtime/vframe.hpp"
69 #include "runtime/vmThread.hpp"
70 #include "services/threadService.hpp"
71 #include "utilities/exceptions.hpp"
72 #include "utilities/preserveException.hpp"
73
74
75 #define FIXLATER 0 // REMOVE this when completed.
76
77 // FIXLATER: hook into JvmtiTrace
78 #define TraceJVMTICalls false
79
80 JvmtiEnv::JvmtiEnv(jint version) : JvmtiEnvBase(version) {
81 }
82
83 JvmtiEnv::~JvmtiEnv() {
84 }
85
3612 JvmtiEnv::GetTimerInfo(jvmtiTimerInfo* info_ptr) {
3613 os::javaTimeNanos_info(info_ptr);
3614 return JVMTI_ERROR_NONE;
3615 } /* end GetTimerInfo */
3616
3617
3618 // nanos_ptr - pre-checked for NULL
3619 jvmtiError
3620 JvmtiEnv::GetTime(jlong* nanos_ptr) {
3621 *nanos_ptr = os::javaTimeNanos();
3622 return JVMTI_ERROR_NONE;
3623 } /* end GetTime */
3624
3625
3626 // processor_count_ptr - pre-checked for NULL
3627 jvmtiError
3628 JvmtiEnv::GetAvailableProcessors(jint* processor_count_ptr) {
3629 *processor_count_ptr = os::active_processor_count();
3630 return JVMTI_ERROR_NONE;
3631 } /* end GetAvailableProcessors */
3632
3633 //
3634 // System Properties functions
3635 //
3636
3637 // count_ptr - pre-checked for NULL
3638 // property_ptr - pre-checked for NULL
3639 jvmtiError
3640 JvmtiEnv::GetSystemProperties(jint* count_ptr, char*** property_ptr) {
3641 jvmtiError err = JVMTI_ERROR_NONE;
3642
3643 // Get the number of readable properties.
3644 *count_ptr = Arguments::PropertyList_readable_count(Arguments::system_properties());
3645
3646 // Allocate memory to hold the exact number of readable properties.
3647 err = allocate(*count_ptr * sizeof(char *), (unsigned char **)property_ptr);
3648 if (err != JVMTI_ERROR_NONE) {
3649 return err;
3650 }
3651 int readable_count = 0;
|
46 #include "prims/jvmtiCodeBlobEvents.hpp"
47 #include "prims/jvmtiExtensions.hpp"
48 #include "prims/jvmtiGetLoadedClasses.hpp"
49 #include "prims/jvmtiImpl.hpp"
50 #include "prims/jvmtiManageCapabilities.hpp"
51 #include "prims/jvmtiRawMonitor.hpp"
52 #include "prims/jvmtiRedefineClasses.hpp"
53 #include "prims/jvmtiTagMap.hpp"
54 #include "prims/jvmtiThreadState.inline.hpp"
55 #include "prims/jvmtiUtil.hpp"
56 #include "runtime/arguments.hpp"
57 #include "runtime/deoptimization.hpp"
58 #include "runtime/interfaceSupport.hpp"
59 #include "runtime/javaCalls.hpp"
60 #include "runtime/jfieldIDWorkaround.hpp"
61 #include "runtime/jniHandles.inline.hpp"
62 #include "runtime/osThread.hpp"
63 #include "runtime/reflectionUtils.hpp"
64 #include "runtime/signature.hpp"
65 #include "runtime/thread.inline.hpp"
66 #include "runtime/threadHeapSampler.hpp"
67 #include "runtime/threadSMR.hpp"
68 #include "runtime/timerTrace.hpp"
69 #include "runtime/vframe.hpp"
70 #include "runtime/vmThread.hpp"
71 #include "services/threadService.hpp"
72 #include "utilities/exceptions.hpp"
73 #include "utilities/preserveException.hpp"
74
75
76 #define FIXLATER 0 // REMOVE this when completed.
77
78 // FIXLATER: hook into JvmtiTrace
79 #define TraceJVMTICalls false
80
81 JvmtiEnv::JvmtiEnv(jint version) : JvmtiEnvBase(version) {
82 }
83
84 JvmtiEnv::~JvmtiEnv() {
85 }
86
3613 JvmtiEnv::GetTimerInfo(jvmtiTimerInfo* info_ptr) {
3614 os::javaTimeNanos_info(info_ptr);
3615 return JVMTI_ERROR_NONE;
3616 } /* end GetTimerInfo */
3617
3618
3619 // nanos_ptr - pre-checked for NULL
3620 jvmtiError
3621 JvmtiEnv::GetTime(jlong* nanos_ptr) {
3622 *nanos_ptr = os::javaTimeNanos();
3623 return JVMTI_ERROR_NONE;
3624 } /* end GetTime */
3625
3626
3627 // processor_count_ptr - pre-checked for NULL
3628 jvmtiError
3629 JvmtiEnv::GetAvailableProcessors(jint* processor_count_ptr) {
3630 *processor_count_ptr = os::active_processor_count();
3631 return JVMTI_ERROR_NONE;
3632 } /* end GetAvailableProcessors */
3633
3634 jvmtiError
3635 JvmtiEnv::SetHeapSamplingRate(jint sampling_rate) {
3636 ThreadHeapSampler::set_tlab_heap_sampling(sampling_rate);
3637 return JVMTI_ERROR_NONE;
3638 } /* end SetHeapSamplingRate */
3639
3640 //
3641 // System Properties functions
3642 //
3643
3644 // count_ptr - pre-checked for NULL
3645 // property_ptr - pre-checked for NULL
3646 jvmtiError
3647 JvmtiEnv::GetSystemProperties(jint* count_ptr, char*** property_ptr) {
3648 jvmtiError err = JVMTI_ERROR_NONE;
3649
3650 // Get the number of readable properties.
3651 *count_ptr = Arguments::PropertyList_readable_count(Arguments::system_properties());
3652
3653 // Allocate memory to hold the exact number of readable properties.
3654 err = allocate(*count_ptr * sizeof(char *), (unsigned char **)property_ptr);
3655 if (err != JVMTI_ERROR_NONE) {
3656 return err;
3657 }
3658 int readable_count = 0;
|