refactor jscMemoryMetrics to use HeapStats

Reviewed By: amnn

Differential Revision: D4558963

fbshipit-source-id: 8b729c6ce288d30b8d069be34f9db7572d8b3ec4
This commit is contained in:
Charles Dick 2017-02-22 11:14:26 -08:00 committed by Facebook Github Bot
parent 6fbc2c9972
commit a151fce1ca
1 changed files with 4 additions and 0 deletions

View File

@ -25,6 +25,10 @@ static JSValueRef nativeGetHeapStats(
result.setProperty("extra_size", {ctx, Value::makeNumber(ctx, heapStats.extraSize)});
result.setProperty("capacity", {ctx, Value::makeNumber(ctx, heapStats.capacity)});
result.setProperty("object_count", {ctx, Value::makeNumber(ctx, heapStats.objectCount)});
result.setProperty("object_size", {ctx, Value::makeNumber(ctx, heapStats.objectSizeAfterLastCollect)});
result.setProperty("object_capacity", {ctx, Value::makeNumber(ctx, heapStats.objectCapacityAfterLastCollect)});
result.setProperty("block_size", {ctx, Value::makeNumber(ctx, heapStats.blockSize)});
result.setProperty("malloc_size", {ctx, Value::makeNumber(ctx, heapStats.mallocSize)});
return (JSObjectRef) result;
}