Path: blob/master/runtime/gc_check/ScanFormatter.cpp
5985 views
/*******************************************************************************1* Copyright (c) 1991, 2014 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122/**23* @file24* @ingroup GC_Check25*/2627#include "j9.h"28#include "j9cfg.h"2930#include "ScanFormatter.hpp"3132void33GC_ScanFormatter::section(const char *type, void *pointer)34{35PORT_ACCESS_FROM_PORT(_portLibrary);3637j9tty_printf(PORTLIB, " <%s (%p)>\n", type, pointer);38_currentCount = 0;39}4041void42GC_ScanFormatter::section(const char *type)43{44PORT_ACCESS_FROM_PORT(_portLibrary);4546j9tty_printf(PORTLIB, " <%s>\n", type);47_currentCount = 0;48}4950void51GC_ScanFormatter::endSection()52{53PORT_ACCESS_FROM_PORT(_portLibrary);5455if ((0 != _currentCount) && _displayedData) {56j9tty_printf(PORTLIB,">\n");57_currentCount = 0;58}59}6061void62GC_ScanFormatter::entry(void *pointer)63{64PORT_ACCESS_FROM_PORT(_portLibrary);6566if (0 == _currentCount) {67j9tty_printf(PORTLIB, " <");68_displayedData = true;69}70j9tty_printf(PORTLIB, "%p ", pointer);7172_currentCount += 1;7374if (NUMBER_ELEMENTS_DISPLAYED_PER_LINE == _currentCount) {75j9tty_printf(PORTLIB, ">\n");76_currentCount = 0;77}78}7980void81GC_ScanFormatter::end(const char *type, void *pointer)82{83PORT_ACCESS_FROM_PORT(_portLibrary);8485if ((0 != _currentCount) && _displayedData) {86j9tty_printf(PORTLIB,">\n");87}88j9tty_printf(PORTLIB, "<gc check: End scan %s (%p)>\n", type, pointer);89}9091void92GC_ScanFormatter::end(const char *type)93{94PORT_ACCESS_FROM_PORT(_portLibrary);9596if ((0 != _currentCount) && _displayedData) {97j9tty_printf(PORTLIB,">\n");98}99j9tty_printf(PORTLIB, "<gc check: End scan %s>\n", type);100}101102103