Package org.sunflow
Class Benchmark
java.lang.Object
org.sunflow.Benchmark
- All Implemented Interfaces:
Display
,BenchmarkTest
,UserInterface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
void
void
static void
void
print
(UI.Module m, UI.PrintLevel level, String s) Displays some information to the user from the specified module with the specified print level.void
Prepare a progress bar representing a lengthy task.void
taskStop()
Closes the current progress bar to indicate the task is overvoid
taskUpdate
(int current) Updates the current progress bar to a value between the current min and max.
-
Constructor Details
-
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 Details
-
main
-
execute
public void execute() -
kernelBegin
public void kernelBegin()- Specified by:
kernelBegin
in interfaceBenchmarkTest
-
kernelMain
public void kernelMain()- Specified by:
kernelMain
in interfaceBenchmarkTest
-
kernelEnd
public void kernelEnd()- Specified by:
kernelEnd
in interfaceBenchmarkTest
-
print
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 interfaceUserInterface
- Parameters:
m
- module the message came fromlevel
- seriousness of the messages
- string to display
-
taskStart
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 interfaceUserInterface
- Parameters:
s
- desriptive stringmin
- minimum value of the taskmax
- 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 interfaceUserInterface
-
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 interfaceUserInterface
- 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 interfaceDisplay
- Parameters:
w
- width of the rendered image in pixelsh
- height of the rendered image in pixelsbucketSize
- 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. -
imageFill
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. -
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 interfaceDisplay
- Parameters:
x
- x coordinate of the bucket within the imagey
- y coordinate of the bucket within the imagew
- width of the bucket in pixelsh
- height of the bucket in pixelsid
- unique identifier corresponding to the thread which invoked this call
-
imageUpdate
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 exactlyw * h
long and in row major order.- Specified by:
imageUpdate
in interfaceDisplay
- Parameters:
x
- x coordinate of the bucket within the imagey
- y coordinate of the bucket within the imagew
- width of the bucket in pixelsh
- height of the bucket in pixelsdata
- bucket data, this array will be exactlyw * h
longalpha
- pixel coverage data, this array will be exactlyw * h
long
-