summaryrefslogtreecommitdiffstats
path: root/runtime/runtime_stats.h
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-07-12 13:46:57 -0700
committerBrian Carlstrom <bdc@google.com>2013-07-12 17:49:01 -0700
commit7940e44f4517de5e2634a7e07d58d0fb26160513 (patch)
treeac90242d96229a6942f6e24ab137bc1f8f2e0025 /runtime/runtime_stats.h
parent5cd9e3b122f276f610980cbaf0d2ad6ed4cd9088 (diff)
downloadart-7940e44f4517de5e2634a7e07d58d0fb26160513.tar.gz
art-7940e44f4517de5e2634a7e07d58d0fb26160513.tar.bz2
art-7940e44f4517de5e2634a7e07d58d0fb26160513.zip
Create separate Android.mk for main build targets
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81
Diffstat (limited to 'runtime/runtime_stats.h')
-rw-r--r--runtime/runtime_stats.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/runtime/runtime_stats.h b/runtime/runtime_stats.h
new file mode 100644
index 0000000000..55e57ecc1d
--- /dev/null
+++ b/runtime/runtime_stats.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_SRC_RUNTIME_STATS_H_
+#define ART_SRC_RUNTIME_STATS_H_
+
+#include <stdint.h>
+
+namespace art {
+
+// These must match the values in dalvik.system.VMDebug.
+enum StatKinds {
+ KIND_ALLOCATED_OBJECTS = 1<<0,
+ KIND_ALLOCATED_BYTES = 1<<1,
+ KIND_FREED_OBJECTS = 1<<2,
+ KIND_FREED_BYTES = 1<<3,
+ KIND_GC_INVOCATIONS = 1<<4,
+ KIND_CLASS_INIT_COUNT = 1<<5,
+ KIND_CLASS_INIT_TIME = 1<<6,
+
+ // These values exist for backward compatibility.
+ KIND_EXT_ALLOCATED_OBJECTS = 1<<12,
+ KIND_EXT_ALLOCATED_BYTES = 1<<13,
+ KIND_EXT_FREED_OBJECTS = 1<<14,
+ KIND_EXT_FREED_BYTES = 1<<15,
+
+ KIND_GLOBAL_ALLOCATED_OBJECTS = KIND_ALLOCATED_OBJECTS,
+ KIND_GLOBAL_ALLOCATED_BYTES = KIND_ALLOCATED_BYTES,
+ KIND_GLOBAL_FREED_OBJECTS = KIND_FREED_OBJECTS,
+ KIND_GLOBAL_FREED_BYTES = KIND_FREED_BYTES,
+ KIND_GLOBAL_GC_INVOCATIONS = KIND_GC_INVOCATIONS,
+ KIND_GLOBAL_CLASS_INIT_COUNT = KIND_CLASS_INIT_COUNT,
+ KIND_GLOBAL_CLASS_INIT_TIME = KIND_CLASS_INIT_TIME,
+
+ KIND_THREAD_ALLOCATED_OBJECTS = KIND_ALLOCATED_OBJECTS << 16,
+ KIND_THREAD_ALLOCATED_BYTES = KIND_ALLOCATED_BYTES << 16,
+ KIND_THREAD_FREED_OBJECTS = KIND_FREED_OBJECTS << 16,
+ KIND_THREAD_FREED_BYTES = KIND_FREED_BYTES << 16,
+
+ KIND_THREAD_GC_INVOCATIONS = KIND_GC_INVOCATIONS << 16,
+
+ // TODO: failedAllocCount, failedAllocSize
+};
+
+/*
+ * Memory allocation profiler state. This is used both globally and
+ * per-thread.
+ */
+struct PACKED(4) RuntimeStats {
+ RuntimeStats() {
+ Clear(~0);
+ }
+
+ void Clear(int flags) {
+ if ((flags & KIND_ALLOCATED_OBJECTS) != 0) {
+ allocated_objects = 0;
+ }
+ if ((flags & KIND_ALLOCATED_BYTES) != 0) {
+ allocated_bytes = 0;
+ }
+ if ((flags & KIND_FREED_OBJECTS) != 0) {
+ freed_objects = 0;
+ }
+ if ((flags & KIND_FREED_BYTES) != 0) {
+ freed_bytes = 0;
+ }
+ if ((flags & KIND_GC_INVOCATIONS) != 0) {
+ gc_for_alloc_count = 0;
+ }
+ if ((flags & KIND_CLASS_INIT_COUNT) != 0) {
+ class_init_count = 0;
+ }
+ if ((flags & KIND_CLASS_INIT_TIME) != 0) {
+ class_init_time_ns = 0;
+ }
+ }
+
+ // Number of objects allocated.
+ int allocated_objects;
+ // Cumulative size of all objects allocated.
+ int allocated_bytes;
+
+ // Number of objects freed.
+ int freed_objects;
+ // Cumulative size of all freed objects.
+ int freed_bytes;
+
+ // Number of times an allocation triggered a GC.
+ int gc_for_alloc_count;
+
+ // Number of initialized classes.
+ int class_init_count;
+ // Cumulative time spent in class initialization.
+ uint64_t class_init_time_ns;
+
+ DISALLOW_COPY_AND_ASSIGN(RuntimeStats);
+};
+
+} // namespace art
+
+#endif // ART_SRC_HEAP_H_