1*635a8641SAndroid Build Coastguard Worker // Copyright 2015 The Chromium Authors. All rights reserved. 2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file. 4*635a8641SAndroid Build Coastguard Worker 5*635a8641SAndroid Build Coastguard Worker #include "base/android/java_runtime.h" 6*635a8641SAndroid Build Coastguard Worker 7*635a8641SAndroid Build Coastguard Worker #include "jni/Runtime_jni.h" 8*635a8641SAndroid Build Coastguard Worker 9*635a8641SAndroid Build Coastguard Worker namespace base { 10*635a8641SAndroid Build Coastguard Worker namespace android { 11*635a8641SAndroid Build Coastguard Worker GetMemoryUsage(long * total_memory,long * free_memory)12*635a8641SAndroid Build Coastguard Workervoid JavaRuntime::GetMemoryUsage(long* total_memory, long* free_memory) { 13*635a8641SAndroid Build Coastguard Worker JNIEnv* env = base::android::AttachCurrentThread(); 14*635a8641SAndroid Build Coastguard Worker base::android::ScopedJavaLocalRef<jobject> runtime = 15*635a8641SAndroid Build Coastguard Worker JNI_Runtime::Java_Runtime_getRuntime(env); 16*635a8641SAndroid Build Coastguard Worker *total_memory = JNI_Runtime::Java_Runtime_totalMemory(env, runtime); 17*635a8641SAndroid Build Coastguard Worker *free_memory = JNI_Runtime::Java_Runtime_freeMemory(env, runtime); 18*635a8641SAndroid Build Coastguard Worker } 19*635a8641SAndroid Build Coastguard Worker 20*635a8641SAndroid Build Coastguard Worker } // namespace android 21*635a8641SAndroid Build Coastguard Worker } // namespace base 22