comparison src/share/vm/code/codeCache.cpp @ 10405:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 91eba9f82325
children 836a62f43af9 510fbd28919c
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, 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.
43 #include "runtime/arguments.hpp" 43 #include "runtime/arguments.hpp"
44 #include "runtime/icache.hpp" 44 #include "runtime/icache.hpp"
45 #include "runtime/java.hpp" 45 #include "runtime/java.hpp"
46 #include "runtime/mutexLocker.hpp" 46 #include "runtime/mutexLocker.hpp"
47 #include "services/memoryService.hpp" 47 #include "services/memoryService.hpp"
48 #include "trace/tracing.hpp"
48 #include "utilities/xmlstream.hpp" 49 #include "utilities/xmlstream.hpp"
49 50
50 // Helper class for printing in CodeCache 51 // Helper class for printing in CodeCache
51 52
52 class CodeBlob_sizes { 53 class CodeBlob_sizes {
112 code_size += cb->code_size(); 113 code_size += cb->code_size();
113 } 114 }
114 } 115 }
115 }; 116 };
116 117
117
118 // CodeCache implementation 118 // CodeCache implementation
119 119
120 CodeHeap * CodeCache::_heap = new CodeHeap(); 120 CodeHeap * CodeCache::_heap = new CodeHeap();
121 int CodeCache::_number_of_blobs = 0; 121 int CodeCache::_number_of_blobs = 0;
122 int CodeCache::_number_of_adapters = 0; 122 int CodeCache::_number_of_adapters = 0;
124 int CodeCache::_number_of_nmethods_with_dependencies = 0; 124 int CodeCache::_number_of_nmethods_with_dependencies = 0;
125 bool CodeCache::_needs_cache_clean = false; 125 bool CodeCache::_needs_cache_clean = false;
126 nmethod* CodeCache::_scavenge_root_nmethods = NULL; 126 nmethod* CodeCache::_scavenge_root_nmethods = NULL;
127 nmethod* CodeCache::_saved_nmethods = NULL; 127 nmethod* CodeCache::_saved_nmethods = NULL;
128 128
129 int CodeCache::_codemem_full_count = 0;
129 130
130 CodeBlob* CodeCache::first() { 131 CodeBlob* CodeCache::first() {
131 assert_locked_or_safepoint(CodeCache_lock); 132 assert_locked_or_safepoint(CodeCache_lock);
132 return (CodeBlob*)_heap->first(); 133 return (CodeBlob*)_heap->first();
133 } 134 }
827 FOR_ALL_ALIVE_BLOBS(p) { 828 FOR_ALL_ALIVE_BLOBS(p) {
828 p->verify(); 829 p->verify();
829 } 830 }
830 } 831 }
831 832
833 void CodeCache::report_codemem_full() {
834 _codemem_full_count++;
835 EventCodeCacheFull event;
836 if (event.should_commit()) {
837 event.set_startAddress((u8)low_bound());
838 event.set_commitedTopAddress((u8)high());
839 event.set_reservedTopAddress((u8)high_bound());
840 event.set_entryCount(nof_blobs());
841 event.set_methodCount(nof_nmethods());
842 event.set_adaptorCount(nof_adapters());
843 event.set_unallocatedCapacity(unallocated_capacity()/K);
844 event.set_fullCount(_codemem_full_count);
845 event.commit();
846 }
847 }
848
832 //------------------------------------------------------------------------------------------------ 849 //------------------------------------------------------------------------------------------------
833 // Non-product version 850 // Non-product version
834 851
835 #ifndef PRODUCT 852 #ifndef PRODUCT
836 853