Skip to content

Commit

Permalink
Fix .gitignore and remove uneeded import
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jul 16, 2016
1 parent bd869ab commit 2fc24e1
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ local.properties
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
Expand Down
1 change: 0 additions & 1 deletion haxe/ui/core/Component.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package haxe.ui.core;

import haxe.ui.core.Component.DeferredBindingInfo;
import haxe.ui.debug.DebugCounter;
import haxe.ui.layouts.DefaultLayout;
import haxe.ui.layouts.DelegateLayout;
import haxe.ui.layouts.Layout;
Expand Down
52 changes: 52 additions & 0 deletions haxe/ui/debug/DebugCounter.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package haxe.ui.debug;

import haxe.ui.core.Component;
import haxe.ui.util.CallStackHelper;

class DebugCounter {
public var name:String;
private var _counters:Map<String, Int> = new Map<String, Int>();
private var _stacks:Map<String, Int> = new Map<String, Int>();

public function new(name:String = null) {
this.name = name;
}

public function incrementComponent(component:Component, fn:String = null, by:Int = 1) {
var key:String = buildComponentKey(component);
if (fn != null) {
key += '::${fn}';
}
if (_counters.exists(key) == false) {
_counters.set(key, 0);
}
_counters.set(key, _counters.get(key) + by);

var stack:String = CallStackHelper.getCallStackString();
CallStackHelper.traceCallStack();
if (_stacks.exists(stack) == false) {
_stacks.set(stack, 0);
}
_stacks.set(stack, _stacks.get(stack) + 1);
}

public function list() {
trace("--------------------------------------------------------------------------------");
var total:Int = 0;
for (key in _counters.keys()) {
trace('${key} - ${_counters.get(key)}');
total += _counters.get(key);
}
trace('total: ${total}');
trace("--------------------------------------------------------------------------------");
for (stack in _stacks.keys()) {
trace(stack);
trace("STACK COUNT: " + _stacks.get(stack));
trace("--------------------------------------------------------------------------------");
}
}

private function buildComponentKey(component:Component):String {
return '${component}#${component.id}';
}
}

0 comments on commit 2fc24e1

Please sign in to comment.