mirror of
https://github.com/MapMakersAndProgrammers/Alternativa3D.git
synced 2025-10-26 09:59:10 -07:00
Remove CPU time from diagram
This commit is contained in:
@@ -197,7 +197,6 @@ public class Camera3D extends Object3D {
|
|||||||
var occluder:Occluder;
|
var occluder:Occluder;
|
||||||
// Error checking
|
// Error checking
|
||||||
if (stage3D == null) throw new TypeError("Parameter stage3D must be non-null.");
|
if (stage3D == null) throw new TypeError("Parameter stage3D must be non-null.");
|
||||||
if (cpuTimer == -1) cpuTimer = getTimer();
|
|
||||||
// Reset the counters
|
// Reset the counters
|
||||||
numDraws = 0;
|
numDraws = 0;
|
||||||
numTriangles = 0;
|
numTriangles = 0;
|
||||||
@@ -372,8 +371,6 @@ public class Camera3D extends Object3D {
|
|||||||
// Gather the draws for children
|
// Gather the draws for children
|
||||||
root.collectChildrenDraws(this, lights, lightsLength, root.useShadow);
|
root.collectChildrenDraws(this, lights, lightsLength, root.useShadow);
|
||||||
}
|
}
|
||||||
cpuTimeSum += getTimer() - cpuTimer;
|
|
||||||
cpuTimeCount++;
|
|
||||||
// Mouse events prosessing
|
// Mouse events prosessing
|
||||||
view.processMouseEvents(context3D, this);
|
view.processMouseEvents(context3D, this);
|
||||||
// Render
|
// Render
|
||||||
@@ -385,16 +382,12 @@ public class Camera3D extends Object3D {
|
|||||||
context3D.drawToBitmapData(view._canvas);
|
context3D.drawToBitmapData(view._canvas);
|
||||||
context3D.present();
|
context3D.present();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
cpuTimeSum += getTimer() - cpuTimer;
|
|
||||||
cpuTimeCount++;
|
|
||||||
}
|
}
|
||||||
// Clearing
|
// Clearing
|
||||||
lights.length = 0;
|
lights.length = 0;
|
||||||
childLights.length = 0;
|
childLights.length = 0;
|
||||||
occluders.length = 0;
|
occluders.length = 0;
|
||||||
context3D = null;
|
context3D = null;
|
||||||
cpuTimer = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -761,7 +754,6 @@ public class Camera3D extends Object3D {
|
|||||||
|
|
||||||
private var fpsTextField:TextField;
|
private var fpsTextField:TextField;
|
||||||
private var frameTextField:TextField;
|
private var frameTextField:TextField;
|
||||||
private var cpuTextField:TextField;
|
|
||||||
private var memoryTextField:TextField;
|
private var memoryTextField:TextField;
|
||||||
private var drawsTextField:TextField;
|
private var drawsTextField:TextField;
|
||||||
private var trianglesTextField:TextField;
|
private var trianglesTextField:TextField;
|
||||||
@@ -783,13 +775,6 @@ public class Camera3D extends Object3D {
|
|||||||
private var methodTimeSum:int;
|
private var methodTimeSum:int;
|
||||||
private var methodTimeCount:int;
|
private var methodTimeCount:int;
|
||||||
private var methodTimer:int;
|
private var methodTimer:int;
|
||||||
private var cpuTimeSum:int = 0;
|
|
||||||
private var cpuTimeCount:int = 0;
|
|
||||||
private var cpuTimer:int = -1;
|
|
||||||
|
|
||||||
public function startCPUTimer():void {
|
|
||||||
cpuTimer = getTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts time count. <code>startTimer()</code>and <code>stopTimer()</code> are necessary to measure time for code part executing.
|
* Starts time count. <code>startTimer()</code>and <code>stopTimer()</code> are necessary to measure time for code part executing.
|
||||||
@@ -899,15 +884,6 @@ public class Camera3D extends Object3D {
|
|||||||
frameTextField.x = -3;
|
frameTextField.x = -3;
|
||||||
frameTextField.y = 4;
|
frameTextField.y = 4;
|
||||||
diagram.addChild(frameTextField);
|
diagram.addChild(frameTextField);
|
||||||
// cpu time
|
|
||||||
cpuTextField = new TextField();
|
|
||||||
cpuTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0xCCCCCC);
|
|
||||||
cpuTextField.autoSize = TextFieldAutoSize.LEFT;
|
|
||||||
cpuTextField.text = "CPU:";
|
|
||||||
cpuTextField.selectable = false;
|
|
||||||
cpuTextField.x = -3;
|
|
||||||
cpuTextField.y = 13;
|
|
||||||
diagram.addChild(cpuTextField);
|
|
||||||
// time of method execution
|
// time of method execution
|
||||||
timerTextField = new TextField();
|
timerTextField = new TextField();
|
||||||
timerTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0x0066FF);
|
timerTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0x0066FF);
|
||||||
@@ -915,7 +891,7 @@ public class Camera3D extends Object3D {
|
|||||||
timerTextField.text = "MS:";
|
timerTextField.text = "MS:";
|
||||||
timerTextField.selectable = false;
|
timerTextField.selectable = false;
|
||||||
timerTextField.x = -3;
|
timerTextField.x = -3;
|
||||||
timerTextField.y = 22;
|
timerTextField.y = 13;
|
||||||
diagram.addChild(timerTextField);
|
diagram.addChild(timerTextField);
|
||||||
// memory
|
// memory
|
||||||
memoryTextField = new TextField();
|
memoryTextField = new TextField();
|
||||||
@@ -924,7 +900,7 @@ public class Camera3D extends Object3D {
|
|||||||
memoryTextField.text = "MEM:";
|
memoryTextField.text = "MEM:";
|
||||||
memoryTextField.selectable = false;
|
memoryTextField.selectable = false;
|
||||||
memoryTextField.x = -3;
|
memoryTextField.x = -3;
|
||||||
memoryTextField.y = 31;
|
memoryTextField.y = 22;
|
||||||
diagram.addChild(memoryTextField);
|
diagram.addChild(memoryTextField);
|
||||||
// debug draws
|
// debug draws
|
||||||
drawsTextField = new TextField();
|
drawsTextField = new TextField();
|
||||||
@@ -933,7 +909,7 @@ public class Camera3D extends Object3D {
|
|||||||
drawsTextField.text = "DRW:";
|
drawsTextField.text = "DRW:";
|
||||||
drawsTextField.selectable = false;
|
drawsTextField.selectable = false;
|
||||||
drawsTextField.x = -3;
|
drawsTextField.x = -3;
|
||||||
drawsTextField.y = 40;
|
drawsTextField.y = 31;
|
||||||
diagram.addChild(drawsTextField);
|
diagram.addChild(drawsTextField);
|
||||||
// triangles
|
// triangles
|
||||||
trianglesTextField = new TextField();
|
trianglesTextField = new TextField();
|
||||||
@@ -942,7 +918,7 @@ public class Camera3D extends Object3D {
|
|||||||
trianglesTextField.text = "TRI:";
|
trianglesTextField.text = "TRI:";
|
||||||
trianglesTextField.selectable = false;
|
trianglesTextField.selectable = false;
|
||||||
trianglesTextField.x = -3;
|
trianglesTextField.x = -3;
|
||||||
trianglesTextField.y = 49;
|
trianglesTextField.y = 40;
|
||||||
diagram.addChild(trianglesTextField);
|
diagram.addChild(trianglesTextField);
|
||||||
// diagram initialization
|
// diagram initialization
|
||||||
diagram.addEventListener(Event.ADDED_TO_STAGE, function ():void {
|
diagram.addEventListener(Event.ADDED_TO_STAGE, function ():void {
|
||||||
@@ -967,16 +943,6 @@ public class Camera3D extends Object3D {
|
|||||||
frameTextField.y = 4;
|
frameTextField.y = 4;
|
||||||
frameTextField.width = 85;
|
frameTextField.width = 85;
|
||||||
diagram.addChild(frameTextField);
|
diagram.addChild(frameTextField);
|
||||||
// CPU time
|
|
||||||
cpuTextField = new TextField();
|
|
||||||
cpuTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0xCCCCCC);
|
|
||||||
cpuTextField.autoSize = TextFieldAutoSize.RIGHT;
|
|
||||||
cpuTextField.text = "";
|
|
||||||
cpuTextField.selectable = false;
|
|
||||||
cpuTextField.x = -3;
|
|
||||||
cpuTextField.y = 13;
|
|
||||||
cpuTextField.width = 85;
|
|
||||||
diagram.addChild(cpuTextField);
|
|
||||||
// Time of method performing
|
// Time of method performing
|
||||||
timerTextField = new TextField();
|
timerTextField = new TextField();
|
||||||
timerTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0x0066FF);
|
timerTextField.defaultTextFormat = new TextFormat("Tahoma", 10, 0x0066FF);
|
||||||
@@ -984,7 +950,7 @@ public class Camera3D extends Object3D {
|
|||||||
timerTextField.text = "";
|
timerTextField.text = "";
|
||||||
timerTextField.selectable = false;
|
timerTextField.selectable = false;
|
||||||
timerTextField.x = -3;
|
timerTextField.x = -3;
|
||||||
timerTextField.y = 22;
|
timerTextField.y = 13;
|
||||||
timerTextField.width = 85;
|
timerTextField.width = 85;
|
||||||
diagram.addChild(timerTextField);
|
diagram.addChild(timerTextField);
|
||||||
// Memory
|
// Memory
|
||||||
@@ -994,7 +960,7 @@ public class Camera3D extends Object3D {
|
|||||||
memoryTextField.text = bytesToString(System.totalMemory);
|
memoryTextField.text = bytesToString(System.totalMemory);
|
||||||
memoryTextField.selectable = false;
|
memoryTextField.selectable = false;
|
||||||
memoryTextField.x = -3;
|
memoryTextField.x = -3;
|
||||||
memoryTextField.y = 31;
|
memoryTextField.y = 22;
|
||||||
memoryTextField.width = 85;
|
memoryTextField.width = 85;
|
||||||
diagram.addChild(memoryTextField);
|
diagram.addChild(memoryTextField);
|
||||||
// Draw calls
|
// Draw calls
|
||||||
@@ -1004,7 +970,7 @@ public class Camera3D extends Object3D {
|
|||||||
drawsTextField.text = "0";
|
drawsTextField.text = "0";
|
||||||
drawsTextField.selectable = false;
|
drawsTextField.selectable = false;
|
||||||
drawsTextField.x = -3;
|
drawsTextField.x = -3;
|
||||||
drawsTextField.y = 40;
|
drawsTextField.y = 31;
|
||||||
drawsTextField.width = 72;
|
drawsTextField.width = 72;
|
||||||
diagram.addChild(drawsTextField);
|
diagram.addChild(drawsTextField);
|
||||||
// Number of triangles
|
// Number of triangles
|
||||||
@@ -1014,14 +980,14 @@ public class Camera3D extends Object3D {
|
|||||||
trianglesTextField.text = "0";
|
trianglesTextField.text = "0";
|
||||||
trianglesTextField.selectable = false;
|
trianglesTextField.selectable = false;
|
||||||
trianglesTextField.x = -3;
|
trianglesTextField.x = -3;
|
||||||
trianglesTextField.y = 49;
|
trianglesTextField.y = 40;
|
||||||
trianglesTextField.width = 72;
|
trianglesTextField.width = 72;
|
||||||
diagram.addChild(trianglesTextField);
|
diagram.addChild(trianglesTextField);
|
||||||
// Graph
|
// Graph
|
||||||
graph = new Bitmap(new BitmapData(80, 40, true, 0x20FFFFFF));
|
graph = new Bitmap(new BitmapData(80, 40, true, 0x20FFFFFF));
|
||||||
rect = new Rectangle(0, 0, 1, 40);
|
rect = new Rectangle(0, 0, 1, 40);
|
||||||
graph.x = 0;
|
graph.x = 0;
|
||||||
graph.y = 63;
|
graph.y = 54;
|
||||||
diagram.addChild(graph);
|
diagram.addChild(graph);
|
||||||
// Reset of parameters
|
// Reset of parameters
|
||||||
previousPeriodTime = getTimer();
|
previousPeriodTime = getTimer();
|
||||||
@@ -1042,7 +1008,6 @@ public class Camera3D extends Object3D {
|
|||||||
// Reset
|
// Reset
|
||||||
diagram.removeChild(fpsTextField);
|
diagram.removeChild(fpsTextField);
|
||||||
diagram.removeChild(frameTextField);
|
diagram.removeChild(frameTextField);
|
||||||
diagram.removeChild(cpuTextField);
|
|
||||||
diagram.removeChild(memoryTextField);
|
diagram.removeChild(memoryTextField);
|
||||||
diagram.removeChild(drawsTextField);
|
diagram.removeChild(drawsTextField);
|
||||||
diagram.removeChild(trianglesTextField);
|
diagram.removeChild(trianglesTextField);
|
||||||
@@ -1050,7 +1015,6 @@ public class Camera3D extends Object3D {
|
|||||||
diagram.removeChild(graph);
|
diagram.removeChild(graph);
|
||||||
fpsTextField = null;
|
fpsTextField = null;
|
||||||
frameTextField = null;
|
frameTextField = null;
|
||||||
cpuTextField = null;
|
|
||||||
memoryTextField = null;
|
memoryTextField = null;
|
||||||
drawsTextField = null;
|
drawsTextField = null;
|
||||||
trianglesTextField = null;
|
trianglesTextField = null;
|
||||||
@@ -1124,18 +1088,9 @@ public class Camera3D extends Object3D {
|
|||||||
} else {
|
} else {
|
||||||
timerTextField.text = "";
|
timerTextField.text = "";
|
||||||
}
|
}
|
||||||
if (cpuTimeCount > 0) {
|
|
||||||
value = cpuTimeSum / cpuTimeCount;
|
|
||||||
mod = value * 100 % 100;
|
|
||||||
cpuTextField.text = int(value) + "." + ((mod >= 10) ? mod.toString() : ((mod > 0) ? ("0" + mod) : "00"));
|
|
||||||
} else {
|
|
||||||
cpuTextField.text = "";
|
|
||||||
}
|
|
||||||
timerUpdateCounter = 0;
|
timerUpdateCounter = 0;
|
||||||
methodTimeSum = 0;
|
methodTimeSum = 0;
|
||||||
methodTimeCount = 0;
|
methodTimeCount = 0;
|
||||||
cpuTimeSum = 0;
|
|
||||||
cpuTimeCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// memory text
|
// memory text
|
||||||
|
|||||||
Reference in New Issue
Block a user