test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp
equal
deleted
inserted
replaced
43 heapObjectCallback(jlong class_tag, |
43 heapObjectCallback(jlong class_tag, |
44 jlong size, |
44 jlong size, |
45 jlong* tag_ptr, |
45 jlong* tag_ptr, |
46 void* user_data) { |
46 void* user_data) { |
47 |
47 |
48 if (!NSK_JVMTI_VERIFY( |
48 if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) { |
49 st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1 ))) { |
|
50 nsk_jvmti_setFailStatus(); |
49 nsk_jvmti_setFailStatus(); |
51 } |
50 } |
52 /* Check the returned jvmtiTimerInfo structure */ |
51 /* Check the returned jvmtiTimerInfo structure */ |
53 if (timer_info1.max_value == 0) { |
52 if (timer_info1.max_value == 0) { |
54 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned zero in jvmtiTimerInfo.max_value\n"); |
53 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned zero in jvmtiTimerInfo.max_value\n"); |
62 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n"); |
61 NSK_COMPLAIN0("GetCurrentThreadCpuTimerInfo returned unknown type value in jvmtiTimerInfo.may_skip_backward\n"); |
63 nsk_jvmti_setFailStatus(); |
62 nsk_jvmti_setFailStatus(); |
64 } |
63 } |
65 /* ---------------------------------------------------------------------- */ |
64 /* ---------------------------------------------------------------------- */ |
66 |
65 |
67 if (!NSK_JVMTI_VERIFY( |
66 if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) { |
68 st_jvmti->GetCurrentThreadCpuTime(&nanos ))) { |
|
69 nsk_jvmti_setFailStatus(); |
67 nsk_jvmti_setFailStatus(); |
70 } |
68 } |
71 /* ---------------------------------------------------------------------- */ |
69 /* ---------------------------------------------------------------------- */ |
72 |
70 |
73 if (!NSK_JVMTI_VERIFY( |
71 if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) { |
74 st_jvmti->GetTimerInfo(&timer_info2 ))) { |
|
75 nsk_jvmti_setFailStatus(); |
72 nsk_jvmti_setFailStatus(); |
76 } |
73 } |
77 /* Check the returned jvmtiTimerInfo structure */ |
74 /* Check the returned jvmtiTimerInfo structure */ |
78 if (timer_info2.max_value == 0) { |
75 if (timer_info2.max_value == 0) { |
79 NSK_COMPLAIN0("GetTimerInfo returned zero in jvmtiTimerInfo.max_value\n"); |
76 NSK_COMPLAIN0("GetTimerInfo returned zero in jvmtiTimerInfo.max_value\n"); |
88 nsk_jvmti_setFailStatus(); |
85 nsk_jvmti_setFailStatus(); |
89 } |
86 } |
90 /* ---------------------------------------------------------------------- */ |
87 /* ---------------------------------------------------------------------- */ |
91 |
88 |
92 nanos = 0; |
89 nanos = 0; |
93 if (!NSK_JVMTI_VERIFY( |
90 if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) { |
94 st_jvmti->GetTime(&nanos ))) { |
|
95 nsk_jvmti_setFailStatus(); |
91 nsk_jvmti_setFailStatus(); |
96 } |
92 } |
97 |
93 |
98 /* Iterate over only first object */ |
94 /* Iterate over only first object */ |
99 return JVMTI_ITERATION_ABORT; |
95 return JVMTI_ITERATION_ABORT; |
110 return; |
106 return; |
111 |
107 |
112 { |
108 { |
113 NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n"); |
109 NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n"); |
114 { |
110 { |
115 if (!NSK_JVMTI_VERIFY( |
111 if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap( |
116 jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)user_data))) { |
112 JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)user_data))) { |
117 nsk_jvmti_setFailStatus(); |
113 nsk_jvmti_setFailStatus(); |
118 } |
114 } |
119 } |
115 } |
120 } |
116 } |
121 |
117 |
157 jvmtiCapabilities caps; |
153 jvmtiCapabilities caps; |
158 memset(&caps, 0, sizeof(caps)); |
154 memset(&caps, 0, sizeof(caps)); |
159 caps.can_tag_objects = 1; |
155 caps.can_tag_objects = 1; |
160 caps.can_get_current_thread_cpu_time = 1; |
156 caps.can_get_current_thread_cpu_time = 1; |
161 |
157 |
162 if (!NSK_JVMTI_VERIFY( |
158 if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { |
163 jvmti->AddCapabilities(&caps))) { |
|
164 return JNI_ERR; |
159 return JNI_ERR; |
165 } |
160 } |
166 } |
161 } |
167 |
162 |
168 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) |
163 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) |