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 INT_TYPE.
028     */
029    
030    @Uninterruptible public class IntStream extends org.mmtk.vm.gcspy.IntStream {
031    
032      /****************************************************************************
033       *
034       * Initialization
035       */
036    
037      /**
038       * Construct a new GCspy stream of INT_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 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, StreamConstants.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