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 */
013 package org.jikesrvm.mm.mmtk.gcspy;
014
015 import org.mmtk.utility.gcspy.Color;
016 import org.mmtk.utility.gcspy.GCspy;
017 import org.mmtk.utility.gcspy.StreamConstants;
018 import org.mmtk.utility.gcspy.drivers.AbstractDriver;
019
020 import org.jikesrvm.VM;
021 import static org.jikesrvm.runtime.SysCall.sysCall;
022
023 import org.vmmagic.pragma.*;
024 import org.vmmagic.unboxed.Address;
025
026 /**
027 * Set up a GCspy Stream with data type BYTE_TYPE.
028 */
029
030 @Uninterruptible public class ByteStream extends org.mmtk.vm.gcspy.ByteStream {
031
032 /****************************************************************************
033 *
034 * Initialization
035 */
036
037 /**
038 * Construct a new GCspy stream of BYTE_TYPE
039 * @param driver The driver that owns this Stream
040 * @param name The name of the stream (e.g. "Used space")
041 * @param minValue The minimum value for any item in this stream.
042 * Values less than this will be represented as "minValue-"
043 * @param maxValue The maximum value for any item in this stream.
044 * Values greater than this will be represented as "maxValue+"
045 * @param zeroValue The zero value for this stream
046 * @param defaultValue The default value for this stream
047 * @param stringPre A string to prefix values (e.g. "Used: ")
048 * @param stringPost A string to suffix values (e.g. " bytes.")
049 * @param presentation How a stream value is to be presented.
050 * @param paintStyle How the value is to be painted.
051 * @param indexMaxStream The index of the maximum stream if the presentation is *_VAR.
052 * @param colour The default colour for tiles of this stream
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, StreamConstants.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