view plugins/vm-compiler/agent/src/main/java/com/redhat/thermostat/vm/compiler/model/VmCompilerStat.java @ 2770:bde0a709ca30

Reactive and convert the JVM-Compiler plugin to declarative services. Merge c.r.t.compiler.agent and c.r.t.compiler.common bundles. Reviewed-by: jmatsuok, stooke Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/024798.html
author Chris Lessard <clessard@redhat.com>
date Fri, 06 Oct 2017 14:14:13 -0400
parents plugins/vm-compiler/common/src/main/java/com/redhat/thermostat/vm/compiler/common/VmCompilerStat.java@65616775c98f
children 0633f63d464d
line wrap: on
line source

/*
 * Copyright 2012-2017 Red Hat, Inc.
 *
 * This file is part of Thermostat.
 *
 * Thermostat is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2, or (at your
 * option) any later version.
 *
 * Thermostat 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 for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Thermostat; see the file COPYING.  If not see
 * <http://www.gnu.org/licenses/>.
 *
 * Linking this code with other modules is making a combined work
 * based on this code.  Thus, the terms and conditions of the GNU
 * General Public License cover the whole combination.
 *
 * As a special exception, the copyright holders of this code give
 * you permission to link this code with independent modules to
 * produce an executable, regardless of the license terms of these
 * independent modules, and to copy and distribute the resulting
 * executable under terms of your choice, provided that you also
 * meet, for each linked independent module, the terms and conditions
 * of the license of that module.  An independent module is a module
 * which is not derived from or based on this code.  If you modify
 * this code, you may extend this exception to your version of the
 * library, but you are not obligated to do so.  If you do not wish
 * to do so, delete this exception statement from your version.
 */

package com.redhat.thermostat.vm.compiler.model;

import com.redhat.thermostat.storage.core.Entity;
import com.redhat.thermostat.storage.model.BasePojo;
import com.redhat.thermostat.storage.model.TimeStampedPojo;

@Entity
public class VmCompilerStat extends BasePojo implements TimeStampedPojo {

    // See the jdk sources for more information:
    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options

    public static final int UNKNOWN = -1;

    private String jvmId;
    private long timestamp;

    private long totalCompiles;
    private long totalBailouts;
    private long totalInvalidates;

    /**
     * There's unit no explicitly mentioned for this jstat value anywhere
     * that I could find. The closest thing I got was the hotspot
     * implementation referring to ComplilationMXBean which mentions the
     * return value is in milliseconds.
     */
    private long compilationTime;

    private long lastSize;

    /**
     * From hotspot code, this is an enum with the values:
     * { no_compile, normal_compile, osr_compile, native_compile }
     */
    private long lastType;

    /**
     *  is of the form "name/of/package/Class$InnerClass methodName"
     */
    private String lastMethod;

    /**
     * From hotspot code, this is an enum with the values:
     * { no_compile, normal_compile, osr_compile, native_compile }
     */
    private long lastFailedType;

    /**
     *  is of the form "name/of/package/Class$InnerClass methodName"
     */
    private String lastFailedMethod;

    public VmCompilerStat(String writerId, String vmId, long timestamp, long totalCompiles, long totalBailouts,
                          long totalInvalidates, long compilationTime, long lastSize, long lastType, String lastMethod,
                          long lastFailedType, String lastFailedMethod) {
        super(writerId);
        this.jvmId = vmId;
        this.timestamp = timestamp;
        this.totalCompiles = totalCompiles;
        this.totalBailouts = totalBailouts;
        this.totalInvalidates = totalInvalidates;
        this.compilationTime = compilationTime;
        this.lastSize = lastSize;
        this.lastType = lastType;
        this.lastMethod = lastMethod;
        this.lastFailedType = lastFailedType;
        this.lastFailedMethod = lastFailedMethod;
    }

    public String getJvmId() {
        return jvmId;
    }

    public void setJvmId(String jvmId) {
        this.jvmId = jvmId;
    }

    @Override
    public long getTimeStamp() {
        return timestamp;
    }

    public void setTimeStamp(long timestamp) {
        this.timestamp = timestamp;
    }

    /** Number of compilation tasks performed */
    public long getTotalCompiles() {
        return totalCompiles;
    }

    public void setTotalCompiles(long totalCompiles) {
        this.totalCompiles = totalCompiles;
    }

    /** Number of failed compilation tasks */
    public long getTotalBailouts() {
        return totalBailouts;
    }

    public void setTotalBailouts(long totalBailouts) {
        this.totalBailouts = totalBailouts;
    }

    /** Number of invalidated compilation tasks */
    public long getTotalInvalidates() {
        return totalInvalidates;
    }

    public void setTotalInvalidates(long totalInvalidates) {
        this.totalInvalidates = totalInvalidates;
    }

    /** Time spent in compilation. Cumulative, measured in ms */
    public long getCompilationTime() {
        return compilationTime;
    }

    /** Time spent in compilation. Cumulative, measured in ms */
    public void setCompilationTime(long compilationTime) {
        this.compilationTime = compilationTime;
    }

    /** Code Size in bytes of last compilation */
    public long getLastSize() {
        return lastSize;
    }

    public void setLastSize(long lastSize) {
        this.lastSize = lastSize;
    }

    /** Type of last compilation */
    public long getLastType() {
        return lastType;
    }

    public void setLastType(long lastType) {
        this.lastType = lastType;
    }

    /** Name of class and method for last compile */
    public String getLastMethod() {
        return lastMethod;
    }

    public void setLastMethod(String lastMethod) {
        this.lastMethod = lastMethod;
    }

    /** Type of last failed compilation */
    public long getLastFailedType() {
        return lastFailedType;
    }

    public void setLastFailedType(long lastFailedType) {
        this.lastFailedType = lastFailedType;
    }

    /** Name of class and method for last failed compile */
    public String getLastFailedMethod() {
        return lastFailedMethod;
    }

    public void setLastFailedMethod(String lastFailedMethod) {
        this.lastFailedMethod = lastFailedMethod;
    }

}