29
30 extern "C" {
31
32 /* ============================================================================= */
33
34 static jlong timeout = 0;
35 static jvmtiEnv* st_jvmti = NULL;
36 static jlong nanos = 0;
37 static jvmtiTimerInfo timer_info1, timer_info2;
38 static int *user_data = 0;
39
40 /* ============================================================================= */
41
42 jvmtiIterationControl JNICALL
43 heapObjectCallback(jlong class_tag,
44 jlong size,
45 jlong* tag_ptr,
46 void* user_data) {
47
48 if (!NSK_JVMTI_VERIFY(
49 st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1 ))) {
50 nsk_jvmti_setFailStatus();
51 }
52 /* Check the returned jvmtiTimerInfo structure */
53 if (timer_info1.max_value == 0) {
54 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned zero in jvmtiTimerInfo.max_value\n");
55 nsk_jvmti_setFailStatus();
56 }
57 if (timer_info1.may_skip_forward != JNI_TRUE && timer_info1.may_skip_forward != JNI_FALSE) {
58 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_forward\n");
59 nsk_jvmti_setFailStatus();
60 }
61 if (timer_info1.may_skip_backward != JNI_TRUE && timer_info1.may_skip_backward != JNI_FALSE) {
62 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n");
63 nsk_jvmti_setFailStatus();
64 }
65 /* ---------------------------------------------------------------------- */
66
67 if (!NSK_JVMTI_VERIFY(
68 st_jvmti->GetCurrentThreadCpuTime(&nanos ))) {
69 nsk_jvmti_setFailStatus();
70 }
71 /* ---------------------------------------------------------------------- */
72
73 if (!NSK_JVMTI_VERIFY(
74 st_jvmti->GetTimerInfo(&timer_info2 ))) {
75 nsk_jvmti_setFailStatus();
76 }
77 /* Check the returned jvmtiTimerInfo structure */
78 if (timer_info2.max_value == 0) {
79 NSK_COMPLAIN0("GetTimerInfo returned zero in jvmtiTimerInfo.max_value\n");
80 nsk_jvmti_setFailStatus();
81 }
82 if (timer_info2.may_skip_forward != JNI_TRUE && timer_info2.may_skip_forward != JNI_FALSE) {
83 NSK_COMPLAIN0("GetTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_forward\n");
84 nsk_jvmti_setFailStatus();
85 }
86 if (timer_info2.may_skip_backward != JNI_TRUE && timer_info2.may_skip_backward != JNI_FALSE) {
87 NSK_COMPLAIN0("GetTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n");
88 nsk_jvmti_setFailStatus();
89 }
90 /* ---------------------------------------------------------------------- */
91
92 nanos = 0;
93 if (!NSK_JVMTI_VERIFY(
94 st_jvmti->GetTime(&nanos ))) {
95 nsk_jvmti_setFailStatus();
96 }
97
98 /* Iterate over only first object */
99 return JVMTI_ITERATION_ABORT;
100 }
101
102 /* ============================================================================= */
103
104 /** Agent algorithm. */
105 static void JNICALL
106 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
107
108 NSK_DISPLAY0("Wait for debugee start\n");
109 if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
110 return;
111
112 {
113 NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
114 {
|
29
30 extern "C" {
31
32 /* ============================================================================= */
33
34 static jlong timeout = 0;
35 static jvmtiEnv* st_jvmti = NULL;
36 static jlong nanos = 0;
37 static jvmtiTimerInfo timer_info1, timer_info2;
38 static int *user_data = 0;
39
40 /* ============================================================================= */
41
42 jvmtiIterationControl JNICALL
43 heapObjectCallback(jlong class_tag,
44 jlong size,
45 jlong* tag_ptr,
46 void* user_data) {
47
48 if (!NSK_JVMTI_VERIFY(
49 st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
50 nsk_jvmti_setFailStatus();
51 }
52 /* Check the returned jvmtiTimerInfo structure */
53 if (timer_info1.max_value == 0) {
54 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned zero in jvmtiTimerInfo.max_value\n");
55 nsk_jvmti_setFailStatus();
56 }
57 if (timer_info1.may_skip_forward != JNI_TRUE && timer_info1.may_skip_forward != JNI_FALSE) {
58 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_forward\n");
59 nsk_jvmti_setFailStatus();
60 }
61 if (timer_info1.may_skip_backward != JNI_TRUE && timer_info1.may_skip_backward != JNI_FALSE) {
62 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n");
63 nsk_jvmti_setFailStatus();
64 }
65 /* ---------------------------------------------------------------------- */
66
67 if (!NSK_JVMTI_VERIFY(
68 st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
69 nsk_jvmti_setFailStatus();
70 }
71 /* ---------------------------------------------------------------------- */
72
73 if (!NSK_JVMTI_VERIFY(
74 st_jvmti->GetTimerInfo(&timer_info2))) {
75 nsk_jvmti_setFailStatus();
76 }
77 /* Check the returned jvmtiTimerInfo structure */
78 if (timer_info2.max_value == 0) {
79 NSK_COMPLAIN0("GetTimerInfo returned zero in jvmtiTimerInfo.max_value\n");
80 nsk_jvmti_setFailStatus();
81 }
82 if (timer_info2.may_skip_forward != JNI_TRUE && timer_info2.may_skip_forward != JNI_FALSE) {
83 NSK_COMPLAIN0("GetTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_forward\n");
84 nsk_jvmti_setFailStatus();
85 }
86 if (timer_info2.may_skip_backward != JNI_TRUE && timer_info2.may_skip_backward != JNI_FALSE) {
87 NSK_COMPLAIN0("GetTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n");
88 nsk_jvmti_setFailStatus();
89 }
90 /* ---------------------------------------------------------------------- */
91
92 nanos = 0;
93 if (!NSK_JVMTI_VERIFY(
94 st_jvmti->GetTime(&nanos))) {
95 nsk_jvmti_setFailStatus();
96 }
97
98 /* Iterate over only first object */
99 return JVMTI_ITERATION_ABORT;
100 }
101
102 /* ============================================================================= */
103
104 /** Agent algorithm. */
105 static void JNICALL
106 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
107
108 NSK_DISPLAY0("Wait for debugee start\n");
109 if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
110 return;
111
112 {
113 NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
114 {
|