Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Index: InternalEventsProfiler.as
===================================================================
--- InternalEventsProfiler.as (revision 45)
+++ InternalEventsProfiler.as (working copy)
@@ -90,8 +90,8 @@
private var mBitmapBackgroundData:BitmapData = null;
private var mBitmapBackground:Bitmap = null;
+ private var mEventsHeaderData:BitmapData = null;
-
private var frameCount:int = 0;
public function InternalEventsProfiler(mainSprite:Stage)
@@ -138,7 +138,7 @@
mFrameDivision.x = 0;
mFrameDivision.y =mainSprite.stageHeight- mFrameDivisionData.height;
- var mEventsHeaderData:BitmapData = new BitmapData(mainSprite.stageWidth, 50, false, 0);
+ mEventsHeaderData = new BitmapData(mainSprite.stageWidth, 50, false, 0);
var mEventsHeader:Bitmap = new Bitmap(mEventsHeaderData);
mEventsHeader.y = 22;
mInterface.addChild(mEventsHeader);
@@ -200,7 +200,18 @@
m.tx = rect.x + 12; m.ty = rect.y-4;
mInternalEventsLabels.text = "RENDER";
mEventsHeaderData.draw(mInternalEventsLabels, m);
-
+
+ rect.x = 4+4*100; rect.y = 2+1*14;
+ mEventsHeaderData.fillRect(rect, PRE_RENDER_COLOR);
+ m.tx = rect.x + 10; m.ty = rect.y-4;
+ mInternalEventsLabels.text = "+";
+ mEventsHeaderData.draw(mInternalEventsLabels, m);
+ rect.x += 19; rect.y = 2+1*14;
+ mEventsHeaderData.fillRect(rect, RENDER_COLOR);
+ m.tx = rect.x + 12; m.ty = rect.y-4;
+ mInternalEventsLabels.text = "=";
+ mEventsHeaderData.draw(mInternalEventsLabels, m);
+
rect.x = 4+0*100; rect.y = 2+2*14;
mEventsHeaderData.fillRect(rect, AVM1_COLOR);
m.tx = rect.x + 12; m.ty = rect.y-4;
@@ -241,14 +252,10 @@
//SampleAnalyzer.GetInstance().StartSampling();
}
- private var mLastTime:int = 0;
private var mProfilerWasActive:Boolean = false;
public function Update():void
{
-
if (frameCount++ % Options.mCurrentClock != 0) return;
- var diff:int= getTimer()-mLastTime;
- mLastTime = getTimer();
SampleAnalyzer.GetInstance().PauseSampling();
SampleAnalyzer.GetInstance().ProcessSampling();
@@ -304,8 +311,21 @@
mFrameDivisionData.fillRect(new Rectangle(lastX+2, 0, 1, 2), 0xFF000000);
//ratio = Math.ceil(selfTime / totalTime * mFrameDivisionData.width);
//mFrameDivisionData.fillRect(new Rectangle(lastX, 0, ratio, 2), 0xFF000000);
- //lastX += ratio;
-
+ //lastX += ratio;
+
+ var rect:Rectangle = new Rectangle();
+ rect.height = 10; rect.width = 20;
+ rect.x = 4 + 4 * 100 + 40; rect.y = 2 + 1*14;
+ mEventsHeaderData.fillRect(rect, 0x000000);
+
+ var m:Matrix = new Matrix();
+ m.identity();
+ m.tx = rect.x; m.ty = rect.y-4;
+ var totalRenderTime:Number = internalEvents.mPreRender.entryTime + internalEvents.mRender.entryTime;
+ var frameAvgRenderTime:Number = totalRenderTime/Options.mCurrentClock;
+ mInternalEventsLabels.text = Math.floor(frameAvgRenderTime/1000).toString() + " ms";
+ mEventsHeaderData.draw(mInternalEventsLabels, m);
+
internalEvents.ResetFrame();
Render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.