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.BYTE_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 BYTE_TYPE.
027 */
028
029@Uninterruptible public class ByteStream extends org.mmtk.vm.gcspy.ByteStream {
030
031  /****************************************************************************
032   *
033   * Initialization
034   */
035
036  /**
037   * Construct a new GCspy stream of BYTE_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 ByteStream(
055         AbstractDriver driver,
056         String name,
057         byte minValue,
058         byte maxValue,
059         byte zeroValue,
060         byte defaultValue,
061         String stringPre,
062         String stringPost,
063         int presentation,
064         int paintStyle,
065         int indexMaxStream,
066         Color colour,
067         boolean summary) {
068    super(driver, name,
069          minValue, maxValue, zeroValue, defaultValue,
070          stringPre, stringPost, presentation, paintStyle,
071          indexMaxStream, colour, summary);
072
073    if (VM.BuildWithGCSpy) {
074      // We never delete these
075      Address tmpName = GCspy.util.getBytes(name);
076      Address tmpPre = GCspy.util.getBytes(stringPre);
077      Address tmpPost = GCspy.util.getBytes(stringPost);
078
079      sysCall.gcspyStreamInit(stream, streamId, BYTE_TYPE,
080          tmpName, minValue, maxValue, zeroValue, defaultValue,
081          tmpPre, tmpPost, presentation, paintStyle, indexMaxStream,
082          colour.getRed(), colour.getGreen(), colour.getBlue());
083    }
084  }
085
086}
087