This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
// Copyright 2004-present Facebook. All Rights Reserved. |
|
|
|
#include "JSCMemory.h" |
|
|
|
#ifdef WITH_FB_MEMORY_PROFILING |
|
|
|
#include <stdio.h> |
|
#include <string.h> |
|
#include <JavaScriptCore/API/JSProfilerPrivate.h> |
|
#include <jschelpers/JSCHelpers.h> |
|
#include <jschelpers/Value.h> |
|
|
|
using namespace facebook::react; |
|
|
|
static JSValueRef nativeCaptureHeap( |
|
JSContextRef ctx, |
|
JSObjectRef function, |
|
JSObjectRef thisObject, |
|
size_t argumentCount, |
|
const JSValueRef arguments[], |
|
JSValueRef* exception) { |
|
if (argumentCount < 1) { |
|
if (exception) { |
|
*exception = Value::makeError( |
|
ctx, |
|
"nativeCaptureHeap requires the path to save the capture"); |
|
} |
|
return Value::makeUndefined(ctx); |
|
} |
|
|
|
auto outputFilename = Value(ctx, arguments[0]).toString(); |
|
JSCaptureHeap(ctx, outputFilename.str().c_str(), exception); |
|
return Value::makeUndefined(ctx); |
|
} |
|
|
|
#endif // WITH_FB_MEMORY_PROFILING |
|
|
|
namespace facebook { |
|
namespace react { |
|
|
|
void addJSCMemoryHooks(JSGlobalContextRef ctx) { |
|
#ifdef WITH_FB_MEMORY_PROFILING |
|
installGlobalFunction(ctx, "nativeCaptureHeap", nativeCaptureHeap); |
|
#endif // WITH_FB_MEMORY_PROFILING |
|
} |
|
|
|
} }
|
|
|