Browse Source

Create profiler. Add option for major GC

Hugh Sanderson 13 years ago
parent
commit
02be5a7bee
2 changed files with 19 additions and 5 deletions
  1. 1 5
      std/cpp/vm/Gc.hx
  2. 18 0
      std/cpp/vm/Profiler.hx

+ 1 - 5
std/cpp/vm/Gc.hx

@@ -9,7 +9,7 @@ class Gc
 
 
    static public function run(major:Bool) : Void
    static public function run(major:Bool) : Void
    {
    {
-      untyped __global__.__hxcpp_collect();
+      untyped __global__.__hxcpp_collect(major);
    }
    }
 
 
    static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int
    static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int
@@ -17,12 +17,8 @@ class Gc
       return untyped __global__.__hxcpp_gc_trace(sought,printInstances);
       return untyped __global__.__hxcpp_gc_trace(sought,printInstances);
    }
    }
 
 
-   // Can't add these until the next hxcpp release....
-   @:functionCode("\n#ifdef HXCPP_GC_FUNCTIONS_1\n")
-   @:functionTailCode('\n#else\n#error "Please upgrade your version of HXCPP"\n#endif\n')
    static public function versionCheck() { return true; }
    static public function versionCheck() { return true; }
 
 
-
    static public function doNotKill(inObject:Dynamic) : Void
    static public function doNotKill(inObject:Dynamic) : Void
    {
    {
       untyped __global__.__hxcpp_gc_do_not_kill(inObject);
       untyped __global__.__hxcpp_gc_do_not_kill(inObject);

+ 18 - 0
std/cpp/vm/Profiler.hx

@@ -0,0 +1,18 @@
+package cpp.vm;
+
+class Profiler
+{
+
+   static public function start(?inDumpFile:String) : Void
+   {
+      untyped __global__.__hxcpp_start_profiler(inDumpFile);
+   }
+
+   static public function stop() : Void
+   {
+      untyped __global__.__hxcpp_stop_profiler();
+   }
+
+}
+
+