Skip to content

Commit

Permalink
Delete global profile dumping API
Browse files Browse the repository at this point in the history
Summary:
We would like to eliminate global APIs on HermesRuntime, so remove this
newly added API since it isn't currently in use.

Reviewed By: hoxyq

Differential Revision: D69508799

fbshipit-source-id: 5be841a417a7c8e4abc1611cdb2668f00b003b55
  • Loading branch information
neildhar authored and facebook-github-bot committed Feb 14, 2025
1 parent 91354c6 commit da5aabc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 33 deletions.
9 changes: 0 additions & 9 deletions API/hermes/hermes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,15 +1211,6 @@ sampling_profiler::Profile HermesRuntimeImpl::dumpSampledTraceToProfile() {
#endif // HERMESVM_SAMPLING_PROFILER_AVAILABLE
}

std::vector<sampling_profiler::Profile>
HermesRuntime::dumpSampledTraceToProfilesGlobal() {
#if HERMESVM_SAMPLING_PROFILER_AVAILABLE
return ::hermes::vm::SamplingProfiler::dumpAsProfilesGlobal();
#else
throwHermesNotCompiledWithSamplingProfilerSupport();
#endif // HERMESVM_SAMPLING_PROFILER_AVAILABLE
}

/*static*/ std::unordered_map<std::string, std::vector<std::string>>
HermesRuntime::getExecutedFunctions() {
std::unordered_map<
Expand Down
5 changes: 0 additions & 5 deletions API/hermes/hermes.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ class HERMES_EXPORT HermesRuntime : public jsi::Runtime {
/// Dump sampled stack trace to the given stream.
static void dumpSampledTraceToStream(std::ostream &stream);

/// Dump sampled stack trace for all registered local sampling profiler
/// instances to a data structure that can be used by third parties.
static std::vector<sampling_profiler::Profile>
dumpSampledTraceToProfilesGlobal();

/// Return the executed JavaScript function info.
/// This information holds the segmentID, Virtualoffset and sourceURL.
/// This information is needed specifically to be able to symbolicate non-CJS
Expand Down
5 changes: 0 additions & 5 deletions include/hermes/VM/Profiler/SamplingProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ class SamplingProfiler {
/// Static wrapper for dumpChromeTrace.
static void dumpChromeTraceGlobal(llvh::raw_ostream &OS);

/// Static wrapper for dumpAsProfile. Will dump in separate Profile for each
/// local sampling profiler instance.
static std::vector<facebook::hermes::sampling_profiler::Profile>
dumpAsProfilesGlobal();

/// Enable and start profiling.
static bool enable(double meanHzFreq = 100);

Expand Down
14 changes: 0 additions & 14 deletions lib/VM/Profiler/SamplingProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,6 @@ void SamplingProfiler::serializeInDevToolsFormat(llvh::raw_ostream &OS) {
clear();
}

std::vector<facebook::hermes::sampling_profiler::Profile>
SamplingProfiler::dumpAsProfilesGlobal() {
auto globalProfiler = sampling_profiler::Sampler::get();
std::lock_guard<std::mutex> lk(globalProfiler->profilerLock_);

std::vector<facebook::hermes::sampling_profiler::Profile> profiles;
for (auto *currentProfilerInstance : globalProfiler->profilers_) {
auto profileForCurrentInstance = currentProfilerInstance->dumpAsProfile();
profiles.push_back(std::move(profileForCurrentInstance));
}

return profiles;
}

facebook::hermes::sampling_profiler::Profile SamplingProfiler::dumpAsProfile() {
std::lock_guard<std::mutex> lk(runtimeDataLock_);

Expand Down

0 comments on commit da5aabc

Please sign in to comment.