|
Java example source code file (LogCompilation.java)
The LogCompilation.java Java example source code/* * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ /** * The main command line driver of a parser for LogCompilation output. * @author never */ package com.sun.hotspot.tools.compiler; import java.io.PrintStream; import java.util.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class LogCompilation extends DefaultHandler implements ErrorHandler, Constants { public static void usage(int exitcode) { System.out.println("Usage: LogCompilation [ -v ] [ -c ] [ -s ] [ -e | -n ] file1 ..."); System.out.println(" -c: clean up malformed 1.5 xml"); System.out.println(" -i: print inlining decisions"); System.out.println(" -S: print compilation statistics"); System.out.println(" -s: sort events by start time"); System.out.println(" -e: sort events by elapsed time"); System.out.println(" -n: sort events by name and start"); System.exit(exitcode); } public static void main(String[] args) throws Exception { Comparator<LogEvent> defaultSort = LogParser.sortByStart; boolean statistics = false; boolean printInlining = false; boolean cleanup = false; int index = 0; while (args.length > index) { if (args[index].equals("-e")) { defaultSort = LogParser.sortByElapsed; index++; } else if (args[index].equals("-n")) { defaultSort = LogParser.sortByNameAndStart; index++; } else if (args[index].equals("-s")) { defaultSort = LogParser.sortByStart; index++; } else if (args[index].equals("-c")) { cleanup = true; index++; } else if (args[index].equals("-S")) { statistics = true; index++; } else if (args[index].equals("-h")) { usage(0); } else if (args[index].equals("-i")) { printInlining = true; index++; } else { break; } } if (index >= args.length) { usage(1); } while (index < args.length) { ArrayList<LogEvent> events = LogParser.parse(args[index], cleanup); if (statistics) { printStatistics(events, System.out); } else { Collections.sort(events, defaultSort); for (LogEvent c : events) { if (printInlining && c instanceof Compilation) { Compilation comp = (Compilation)c; comp.print(System.out, true); } else { c.print(System.out); } } } index++; } } public static void printStatistics(ArrayList<LogEvent> events, PrintStream out) { long cacheSize = 0; long maxCacheSize = 0; int nmethodsCreated = 0; int nmethodsLive = 0; int[] attempts = new int[32]; double regallocTime = 0; int maxattempts = 0; LinkedHashMap<String, Double> phaseTime = new LinkedHashMap Other Java examples (source code examples)Here is a short list of links related to this Java LogCompilation.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.