Package org.sunflow

Class Benchmark

    • Constructor Summary

      Constructors 
      Constructor Description
      Benchmark()  
      Benchmark​(int resolution, boolean showOutput, boolean showBenchmarkOutput, boolean saveOutput)  
      Benchmark​(int resolution, boolean showOutput, boolean showBenchmarkOutput, boolean saveOutput, int threads, boolean showWindow)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      void imageBegin​(int w, int h, int bucketSize)
      This is called before an image is rendered to indicate how large the rendered image will be.
      void imageEnd()
      This call is made after the image has been rendered.
      void imageFill​(int x, int y, int w, int h, Color c, float alpha)
      Update the current image with a region of flat color.
      void imagePrepare​(int x, int y, int w, int h, int id)
      Prepare the specified area to be rendered.
      void imageUpdate​(int x, int y, int w, int h, Color[] data, float[] alpha)
      Update the current image with a bucket of data.
      void kernelBegin()  
      void kernelEnd()  
      void kernelMain()  
      static void main​(java.lang.String[] args)  
      void print​(UI.Module m, UI.PrintLevel level, java.lang.String s)
      Displays some information to the user from the specified module with the specified print level.
      void taskStart​(java.lang.String s, int min, int max)
      Prepare a progress bar representing a lengthy task.
      void taskStop()
      Closes the current progress bar to indicate the task is over
      void taskUpdate​(int current)
      Updates the current progress bar to a value between the current min and max.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Benchmark

        public Benchmark()
      • Benchmark

        public Benchmark​(int resolution,
                         boolean showOutput,
                         boolean showBenchmarkOutput,
                         boolean saveOutput)
      • Benchmark

        public Benchmark​(int resolution,
                         boolean showOutput,
                         boolean showBenchmarkOutput,
                         boolean saveOutput,
                         int threads,
                         boolean showWindow)
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • execute

        public void execute()
      • print

        public void print​(UI.Module m,
                          UI.PrintLevel level,
                          java.lang.String s)
        Description copied from interface: UserInterface
        Displays some information to the user from the specified module with the specified print level. A user interface is free to show or ignore any message. Level filtering is done in the core and shouldn't be re-implemented by the user interface. All messages will be short enough to fit on one line.
        Specified by:
        print in interface UserInterface
        Parameters:
        m - module the message came from
        level - seriousness of the message
        s - string to display
      • taskStart

        public void taskStart​(java.lang.String s,
                              int min,
                              int max)
        Description copied from interface: UserInterface
        Prepare a progress bar representing a lengthy task. The actual progress is first shown by the call to update and closed when update is closed with the max value. It is currently not possible to nest calls to setTask, so only one task needs to be tracked at a time.
        Specified by:
        taskStart in interface UserInterface
        Parameters:
        s - desriptive string
        min - minimum value of the task
        max - maximum value of the task
      • taskStop

        public void taskStop()
        Description copied from interface: UserInterface
        Closes the current progress bar to indicate the task is over
        Specified by:
        taskStop in interface UserInterface
      • taskUpdate

        public void taskUpdate​(int current)
        Description copied from interface: UserInterface
        Updates the current progress bar to a value between the current min and max. When min or max are passed the progressed bar is shown or hidden respectively.
        Specified by:
        taskUpdate in interface UserInterface
        Parameters:
        current - current value of the task in progress.
      • imageBegin

        public void imageBegin​(int w,
                               int h,
                               int bucketSize)
        Description copied from interface: Display
        This is called before an image is rendered to indicate how large the rendered image will be. This allows the display driver to write out image headers or allocate surfaces. Bucket size will be 0 when called from a non-bucket based source.
        Specified by:
        imageBegin in interface Display
        Parameters:
        w - width of the rendered image in pixels
        h - height of the rendered image in pixels
        bucketSize - size of the buckets in pixels
      • imageEnd

        public void imageEnd()
        Description copied from interface: Display
        This call is made after the image has been rendered. This allows the display driver to close any open files, write the image to disk or flush any other type of buffers.
        Specified by:
        imageEnd in interface Display
      • imageFill

        public void imageFill​(int x,
                              int y,
                              int w,
                              int h,
                              Color c,
                              float alpha)
        Description copied from interface: Display
        Update the current image with a region of flat color. This is used by progressive rendering to render progressively smaller regions of the screen which will overlap. The region is guarenteed to be within the bounds created by the call to imageBegin. No clipping is necessary. Colors are passed in unprocessed. It is up the display driver to do any type of quantization , gamma compensation or tone-mapping needed.
        Specified by:
        imageFill in interface Display
        Parameters:
        x - x coordinate of the region within the image
        y - y coordinate of the region within the image
        w - with of the region in pixels
        h - height of the region in pixels
        c - color to fill the region with
        alpha - pixel coverage
      • imagePrepare

        public void imagePrepare​(int x,
                                 int y,
                                 int w,
                                 int h,
                                 int id)
        Description copied from interface: Display
        Prepare the specified area to be rendered. This may be used to highlight the work in progress area or simply to setup the display driver to receive the specified portion of the image
        Specified by:
        imagePrepare in interface Display
        Parameters:
        x - x coordinate of the bucket within the image
        y - y coordinate of the bucket within the image
        w - width of the bucket in pixels
        h - height of the bucket in pixels
        id - unique identifier corresponding to the thread which invoked this call
      • imageUpdate

        public void imageUpdate​(int x,
                                int y,
                                int w,
                                int h,
                                Color[] data,
                                float[] alpha)
        Description copied from interface: Display
        Update the current image with a bucket of data. The region is guarenteed to be within the bounds created by the call to imageBegin. No clipping is necessary. Colors are passed in unprocessed. It is up the display driver to do any type of quantization, gamma compensation or tone-mapping needed. The array of colors will be exactly w * h long and in row major order.
        Specified by:
        imageUpdate in interface Display
        Parameters:
        x - x coordinate of the bucket within the image
        y - y coordinate of the bucket within the image
        w - width of the bucket in pixels
        h - height of the bucket in pixels
        data - bucket data, this array will be exactly w * h long
        alpha - pixel coverage data, this array will be exactly w * h long