1212#include < unordered_map>
1313
1414static const uint8_t kMaxStackDepth (128 );
15- static const float kSamplingFrequency (99.0 ); // 99 to avoid lockstep sampling
15+ static const float kSamplingFrequency (99.0 ); // 99 to avoid lockstep sampling
1616static const float kSamplingHz (1 / kSamplingFrequency );
1717static const int kSamplingInterval (kSamplingHz * 1e6 );
18- static const v8::CpuProfilingNamingMode kNamingMode (
19- v8::CpuProfilingNamingMode::kDebugNaming );
20- static const v8::CpuProfilingLoggingMode kDefaultLoggingMode (
21- v8::CpuProfilingLoggingMode::kEagerLogging );
18+ static const v8::CpuProfilingNamingMode
19+ kNamingMode ( v8::CpuProfilingNamingMode::kDebugNaming );
20+ static const v8::CpuProfilingLoggingMode
21+ kDefaultLoggingMode ( v8::CpuProfilingLoggingMode::kEagerLogging );
2222
2323// Allow users to override the default logging mode via env variable. This is
2424// useful because sometimes the flow of the profiled program can be to execute
@@ -57,7 +57,7 @@ enum class ProfileStatus {
5757};
5858
5959class MeasurementsTicker {
60- private:
60+ private:
6161 uv_timer_t timer;
6262 uint64_t period_ms;
6363 std::unordered_map<std::string,
@@ -69,7 +69,7 @@ class MeasurementsTicker {
6969 v8::HeapStatistics heap_stats;
7070 uv_cpu_info_t cpu_stats;
7171
72- public:
72+ public:
7373 MeasurementsTicker (uv_loop_t *loop)
7474 : period_ms(100 ), isolate(v8::Isolate::GetCurrent()) {
7575 uv_timer_init (loop, &timer);
@@ -218,7 +218,7 @@ void MeasurementsTicker::remove_cpu_listener(
218218};
219219
220220class Profiler {
221- public:
221+ public:
222222 std::unordered_map<std::string, SentryProfile *> active_profiles;
223223
224224 MeasurementsTicker measurements_ticker;
@@ -231,7 +231,7 @@ class Profiler {
231231};
232232
233233class SentryProfile {
234- private:
234+ private:
235235 uint64_t started_at;
236236 uint16_t heap_write_index = 0 ;
237237 uint16_t cpu_write_index = 0 ;
@@ -248,7 +248,7 @@ class SentryProfile {
248248 ProfileStatus status = ProfileStatus::kNotStarted ;
249249 std::string id;
250250
251- public:
251+ public:
252252 explicit SentryProfile (const char *id)
253253 : started_at(uv_hrtime()),
254254 memory_sampler_cb([this ](uint64_t ts, v8::HeapStatistics &stats) {
@@ -280,8 +280,7 @@ class SentryProfile {
280280 return false ;
281281 }),
282282
283- status (ProfileStatus::kNotStarted ),
284- id (id) {
283+ status (ProfileStatus::kNotStarted ), id(id) {
285284 heap_stats_ts.reserve (300 );
286285 heap_stats_usage.reserve (300 );
287286 cpu_stats_ts.reserve (300 );
@@ -453,10 +452,10 @@ static napi_value GetFrameModuleWrapped(napi_env env, napi_callback_info info) {
453452 return napi_module;
454453}
455454
456- napi_value CreateFrameNode (
457- const napi_env &env, const v8::CpuProfileNode &node,
458- std::unordered_map<std::string, std::string> &module_cache,
459- napi_value &resources) {
455+ napi_value
456+ CreateFrameNode ( const napi_env &env, const v8::CpuProfileNode &node,
457+ std::unordered_map<std::string, std::string> &module_cache,
458+ napi_value &resources) {
460459 napi_value js_node;
461460 napi_create_object (env, &js_node);
462461
@@ -664,10 +663,11 @@ static void GetSamples(const napi_env &env, const v8::CpuProfile *profile,
664663 }
665664}
666665
667- static napi_value TranslateMeasurementsDouble (
668- const napi_env &env, const char *unit, const uint16_t size,
669- const std::vector<double > &values,
670- const std::vector<uint64_t > ×tamps) {
666+ static napi_value
667+ TranslateMeasurementsDouble (const napi_env &env, const char *unit,
668+ const uint16_t size,
669+ const std::vector<double > &values,
670+ const std::vector<uint64_t > ×tamps) {
671671 if (size > values.size () || size > timestamps.size ()) {
672672 napi_throw_range_error (env, " NAPI_ERROR" ,
673673 " CPU measurement size is larger than the number of "
@@ -718,10 +718,10 @@ static napi_value TranslateMeasurementsDouble(
718718 return measurement;
719719}
720720
721- static napi_value TranslateMeasurements (
722- const napi_env &env, const char *unit, const uint16_t size ,
723- const std::vector<uint64_t > &values,
724- const std::vector<uint64_t > ×tamps) {
721+ static napi_value
722+ TranslateMeasurements ( const napi_env &env, const char *unit,
723+ const uint16_t size, const std::vector<uint64_t > &values,
724+ const std::vector<uint64_t > ×tamps) {
725725 if (size > values.size () || size > timestamps.size ()) {
726726 napi_throw_range_error (env, " NAPI_ERROR" ,
727727 " Memory measurement size is larger than the number "
0 commit comments