comparison src/share/vm/prims/jvmtiEnv.cpp @ 2100:b1a2afa37ec4

7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis Summary: Track allocated bytes in Thread's, update on TLAB retirement and direct allocation in Eden and tenured, add JNI methods for ThreadMXBean. Reviewed-by: coleenp, kvn, dholmes, ysr
author phh
date Fri, 07 Jan 2011 10:42:32 -0500
parents 09b4dd4f152b
children 3582bf76420e
comparison
equal deleted inserted replaced
2097:039eb4201e06 2100:b1a2afa37ec4
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
1800 // java_thread - pre-checked 1800 // java_thread - pre-checked
1801 // java_thread - unchecked 1801 // java_thread - unchecked
1802 // depth - pre-checked as non-negative 1802 // depth - pre-checked as non-negative
1803 // value - pre-checked for NULL 1803 // value - pre-checked for NULL
1804 jvmtiError 1804 jvmtiError
1805 JvmtiEnv::GetLocalInstance(JavaThread* java_thread, jint depth, jobject* value){ 1805 JvmtiEnv::GetLocalInstance(JavaThread* java_thread, jint depth, jobject* value_ptr){
1806 JavaThread* current_thread = JavaThread::current(); 1806 JavaThread* current_thread = JavaThread::current();
1807 // rm object is created to clean up the javaVFrame created in 1807 // rm object is created to clean up the javaVFrame created in
1808 // doit_prologue(), but after doit() is finished with it. 1808 // doit_prologue(), but after doit() is finished with it.
1809 ResourceMark rm(current_thread); 1809 ResourceMark rm(current_thread);
1810 1810
1812 VMThread::execute(&op); 1812 VMThread::execute(&op);
1813 jvmtiError err = op.result(); 1813 jvmtiError err = op.result();
1814 if (err != JVMTI_ERROR_NONE) { 1814 if (err != JVMTI_ERROR_NONE) {
1815 return err; 1815 return err;
1816 } else { 1816 } else {
1817 *value = op.value().l; 1817 *value_ptr = op.value().l;
1818 return JVMTI_ERROR_NONE; 1818 return JVMTI_ERROR_NONE;
1819 } 1819 }
1820 } /* end GetLocalInstance */ 1820 } /* end GetLocalInstance */
1821 1821
1822 1822
3438 3438
3439 3439
3440 // property - pre-checked for NULL 3440 // property - pre-checked for NULL
3441 // value - NULL is a valid value, must be checked 3441 // value - NULL is a valid value, must be checked
3442 jvmtiError 3442 jvmtiError
3443 JvmtiEnv::SetSystemProperty(const char* property, const char* value) { 3443 JvmtiEnv::SetSystemProperty(const char* property, const char* value_ptr) {
3444 jvmtiError err =JVMTI_ERROR_NOT_AVAILABLE; 3444 jvmtiError err =JVMTI_ERROR_NOT_AVAILABLE;
3445 3445
3446 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) { 3446 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
3447 if (strcmp(property, p->key()) == 0) { 3447 if (strcmp(property, p->key()) == 0) {
3448 if (p->set_value((char *)value)) { 3448 if (p->set_value((char *)value_ptr)) {
3449 err = JVMTI_ERROR_NONE; 3449 err = JVMTI_ERROR_NONE;
3450 } 3450 }
3451 } 3451 }
3452 } 3452 }
3453 return err; 3453 return err;