001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.mm.mmtk.gcspy;
014
015import static org.jikesrvm.runtime.SysCall.sysCall;
016import static org.mmtk.utility.gcspy.StreamConstants.INT_TYPE;
017
018import org.jikesrvm.VM;
019import org.mmtk.utility.gcspy.Color;
020import org.mmtk.utility.gcspy.GCspy;
021import org.mmtk.utility.gcspy.drivers.AbstractDriver;
022import org.vmmagic.pragma.Uninterruptible;
023import org.vmmagic.unboxed.Address;
024
025/**
026 * Set up a GCspy Stream with data type INT_TYPE.
027 */
028
029@Uninterruptible public class IntStream extends org.mmtk.vm.gcspy.IntStream {
030
031  /****************************************************************************
032   *
033   * Initialization
034   */
035
036  /**
037   * Construct a new GCspy stream of INT_TYPE.
038   * @param driver         The driver that owns this Stream
039   * @param name           The name of the stream (e.g. "Used space")
040   * @param minValue       The minimum value for any item in this stream.
041   *                       Values less than this will be represented as "minValue-"
042   * @param maxValue       The maximum value for any item in this stream.
043   *                       Values greater than this will be represented as "maxValue+"
044   * @param zeroValue      The zero value for this stream
045   * @param defaultValue   The default value for this stream
046   * @param stringPre      A string to prefix values (e.g. "Used: ")
047   * @param stringPost     A string to suffix values (e.g. " bytes.")
048   * @param presentation   How a stream value is to be presented.
049   * @param paintStyle     How the value is to be painted.
050   * @param indexMaxStream The index of the maximum stream if the presentation is *_VAR.
051   * @param colour         The default colour for tiles of this stream
052   * @param summary        Is a summary enabled?
053   */
054  public IntStream(
055         AbstractDriver driver,
056         String name,
057         int minValue,
058         int maxValue,
059         int zeroValue,
060         int defaultValue,
061         String stringPre,
062         String stringPost,
063         int presentation,
064         int paintStyle,
065         int indexMaxStream,
066         Color colour,
067         boolean summary) {
068
069    super(driver, name,
070          minValue, maxValue, zeroValue, defaultValue,
071          stringPre, stringPost, presentation, paintStyle,
072          indexMaxStream, colour, summary);
073
074    if (VM.BuildWithGCSpy) {
075      // We never delete these
076      Address tmpName = GCspy.util.getBytes(name);
077      Address tmpPre = GCspy.util.getBytes(stringPre);
078      Address tmpPost = GCspy.util.getBytes(stringPost);
079
080      sysCall.gcspyStreamInit(stream, streamId, INT_TYPE,
081          tmpName, minValue, maxValue, zeroValue, defaultValue,
082          tmpPre, tmpPost, presentation, paintStyle, indexMaxStream,
083          colour.getRed(), colour.getGreen(), colour.getBlue());
084    }
085  }
086
087}
088