< prev index next >

src/hotspot/share/jfr/periodic/jfrPeriodic.cpp

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com
   1 /*
   2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 466 
 467 class JfrClassLoaderStatsClosure : public ClassLoaderStatsClosure {
 468 public:
 469   JfrClassLoaderStatsClosure() : ClassLoaderStatsClosure(NULL) {}
 470 
 471   bool do_entry(oop const& key, ClassLoaderStats* const& cls) {
 472     const ClassLoaderData* this_cld = cls->_class_loader != NULL ?
 473       java_lang_ClassLoader::loader_data_acquire(cls->_class_loader) : NULL;
 474     const ClassLoaderData* parent_cld = cls->_parent != NULL ?
 475       java_lang_ClassLoader::loader_data_acquire(cls->_parent) : NULL;
 476     EventClassLoaderStatistics event;
 477     event.set_classLoader(this_cld);
 478     event.set_parentClassLoader(parent_cld);
 479     event.set_classLoaderData((intptr_t)cls->_cld);
 480     event.set_classCount(cls->_classes_count);
 481     event.set_chunkSize(cls->_chunk_sz);
 482     event.set_blockSize(cls->_block_sz);
 483     event.set_unsafeAnonymousClassCount(cls->_anon_classes_count);
 484     event.set_unsafeAnonymousChunkSize(cls->_anon_chunk_sz);
 485     event.set_unsafeAnonymousBlockSize(cls->_anon_block_sz);



 486     event.commit();
 487     return true;
 488   }
 489 
 490   void createEvents(void) {
 491     _stats->iterate(this);
 492   }
 493 };
 494 
 495 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
 496  public:
 497   JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
 498 
 499   void doit() {
 500     JfrClassLoaderStatsClosure clsc;
 501     ClassLoaderDataGraph::loaded_cld_do(&clsc);
 502     clsc.createEvents();
 503   }
 504 };
 505 


   1 /*
   2  * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 466 
 467 class JfrClassLoaderStatsClosure : public ClassLoaderStatsClosure {
 468 public:
 469   JfrClassLoaderStatsClosure() : ClassLoaderStatsClosure(NULL) {}
 470 
 471   bool do_entry(oop const& key, ClassLoaderStats* const& cls) {
 472     const ClassLoaderData* this_cld = cls->_class_loader != NULL ?
 473       java_lang_ClassLoader::loader_data_acquire(cls->_class_loader) : NULL;
 474     const ClassLoaderData* parent_cld = cls->_parent != NULL ?
 475       java_lang_ClassLoader::loader_data_acquire(cls->_parent) : NULL;
 476     EventClassLoaderStatistics event;
 477     event.set_classLoader(this_cld);
 478     event.set_parentClassLoader(parent_cld);
 479     event.set_classLoaderData((intptr_t)cls->_cld);
 480     event.set_classCount(cls->_classes_count);
 481     event.set_chunkSize(cls->_chunk_sz);
 482     event.set_blockSize(cls->_block_sz);
 483     event.set_unsafeAnonymousClassCount(cls->_anon_classes_count);
 484     event.set_unsafeAnonymousChunkSize(cls->_anon_chunk_sz);
 485     event.set_unsafeAnonymousBlockSize(cls->_anon_block_sz);
 486     event.set_hiddenClassCount(cls->_hidden_classes_count);
 487     event.set_hiddenChunkSize(cls->_hidden_chunk_sz);
 488     event.set_hiddenBlockSize(cls->_hidden_block_sz);
 489     event.commit();
 490     return true;
 491   }
 492 
 493   void createEvents(void) {
 494     _stats->iterate(this);
 495   }
 496 };
 497 
 498 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
 499  public:
 500   JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
 501 
 502   void doit() {
 503     JfrClassLoaderStatsClosure clsc;
 504     ClassLoaderDataGraph::loaded_cld_do(&clsc);
 505     clsc.createEvents();
 506   }
 507 };
 508 


< prev index next >