Path: blob/master/runtime/gc_verbose_java/VerboseWriterTrace.cpp
5985 views
1/*******************************************************************************2* Copyright (c) 1991, 2014 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21*******************************************************************************/2223/* TODO (stefanbu) Tracing story unavailable for OMR, this file should be moved back to verbose */2425#include "j9cfg.h"2627#include "VerboseWriterTrace.hpp"2829#include "EnvironmentBase.hpp"30#include "GCExtensions.hpp"3132#define _UTE_STATIC_33#include "ut_j9vgc.h"3435MM_VerboseWriterTrace::MM_VerboseWriterTrace(MM_EnvironmentBase *env) :36MM_VerboseWriter(VERBOSE_WRITER_TRACE)37,_componentLoaded(false)38{39/* no implementation */40}4142/**43* Create a new MM_VerboseWriterTrace instance.44* @return Pointer to the new MM_VerboseWriterTrace.45*/46MM_VerboseWriterTrace *47MM_VerboseWriterTrace::newInstance(MM_EnvironmentBase *env)48{49MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env->getOmrVM());5051MM_VerboseWriterTrace *agent = (MM_VerboseWriterTrace *)extensions->getForge()->allocate(sizeof(MM_VerboseWriterTrace), MM_AllocationCategory::DIAGNOSTIC, J9_GET_CALLSITE());52if (agent) {53new(agent) MM_VerboseWriterTrace(env);54if(!agent->initialize(env)){55agent->kill(env);56agent = NULL;57}58}59return agent;60}6162/**63* Initializes the MM_VerboseWriterTrace instance.64*/65bool66MM_VerboseWriterTrace::initialize(MM_EnvironmentBase *env)67{68return MM_VerboseWriter::initialize(env);69}7071/**72*/73void74MM_VerboseWriterTrace::endOfCycle(MM_EnvironmentBase *env)75{76}7778/**79* Closes the agents output stream.80*/81void82MM_VerboseWriterTrace::closeStream(MM_EnvironmentBase *env)83{84}8586void87MM_VerboseWriterTrace::outputString(MM_EnvironmentBase *env, const char* string)88{89if(!_componentLoaded) {90/* If this is the first time in, we have to load the j9vgc trace component.91* Can't do it at startup because the trace engine initializes too late */92UT_MODULE_LOADED(J9_UTINTERFACE_FROM_VM((J9JavaVM *)env->getLanguageVM()));93_componentLoaded = true;94}9596/* Call the tracepoint that outputs the line of verbosegc */97Trc_VGC_Verbosegc(env->getLanguageVMThread(), string);98}99100101