@encharm/cws 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bindings/cws_linux_108.node +0 -0
- package/dist/bindings/cws_linux_64.node +0 -0
- package/dist/bindings/cws_linux_72.node +0 -0
- package/dist/bindings/cws_linux_79.node +0 -0
- package/dist/bindings/cws_linux_83.node +0 -0
- package/dist/bindings/cws_linux_93.node +0 -0
- package/dist/bindings/cws_win32_64.node +0 -0
- package/dist/bindings/cws_win32_72.node +0 -0
- package/dist/bindings/cws_win32_79.node +0 -0
- package/dist/bindings/cws_win32_83.node +0 -0
- package/dist/bindings/cws_win32_93.node +0 -0
- package/package.json +1 -1
- package/src/Addon.h +24 -2
- package/src/HTTPSocket.cpp +1 -1
- package/src/headers/{13 → 18}/aliased_buffer.h +61 -9
- package/src/headers/18/aliased_struct-inl.h +54 -0
- package/src/headers/18/aliased_struct.h +63 -0
- package/src/headers/{12 → 18}/async_wrap-inl.h +0 -0
- package/src/headers/{12 → 18}/async_wrap.h +26 -2
- package/src/headers/{12/base64.h → 18/base64-inl.h} +78 -86
- package/src/headers/18/base64.h +69 -0
- package/src/headers/{12 → 18}/base_object-inl.h +46 -25
- package/src/headers/{12 → 18}/base_object.h +82 -17
- package/src/headers/{12 → 18}/callback_queue-inl.h +9 -9
- package/src/headers/{12 → 18}/callback_queue.h +13 -5
- package/src/headers/18/cares_wrap.h +523 -0
- package/src/headers/{12 → 18}/connect_wrap.h +0 -0
- package/src/headers/{12 → 18}/connection_wrap.h +0 -0
- package/src/headers/18/crypto/crypto_aes.h +89 -0
- package/src/headers/{13/node_crypto_bio.h → 18/crypto/crypto_bio.h} +3 -4
- package/src/headers/18/crypto/crypto_cipher.h +291 -0
- package/src/headers/{13/node_crypto_clienthello-inl.h → 18/crypto/crypto_clienthello-inl.h} +4 -5
- package/src/headers/{13/node_crypto_clienthello.h → 18/crypto/crypto_clienthello.h} +3 -4
- package/src/headers/{12/node_crypto_common.h → 18/crypto/crypto_common.h} +49 -36
- package/src/headers/18/crypto/crypto_context.h +147 -0
- package/src/headers/18/crypto/crypto_dh.h +156 -0
- package/src/headers/18/crypto/crypto_dsa.h +77 -0
- package/src/headers/18/crypto/crypto_ec.h +170 -0
- package/src/headers/{12/node_crypto_groups.h → 18/crypto/crypto_groups.h} +3 -3
- package/src/headers/18/crypto/crypto_hash.h +89 -0
- package/src/headers/18/crypto/crypto_hkdf.h +65 -0
- package/src/headers/18/crypto/crypto_hmac.h +94 -0
- package/src/headers/18/crypto/crypto_keygen.h +305 -0
- package/src/headers/18/crypto/crypto_keys.h +420 -0
- package/src/headers/18/crypto/crypto_pbkdf2.h +76 -0
- package/src/headers/18/crypto/crypto_random.h +130 -0
- package/src/headers/18/crypto/crypto_rsa.h +141 -0
- package/src/headers/18/crypto/crypto_scrypt.h +87 -0
- package/src/headers/18/crypto/crypto_sig.h +168 -0
- package/src/headers/18/crypto/crypto_spkac.h +21 -0
- package/src/headers/18/crypto/crypto_timing.h +20 -0
- package/src/headers/{13/tls_wrap.h → 18/crypto/crypto_tls.h} +137 -66
- package/src/headers/18/crypto/crypto_util.h +791 -0
- package/src/headers/18/crypto/crypto_x509.h +143 -0
- package/src/headers/{12 → 18}/debug_utils-inl.h +0 -0
- package/src/headers/{13 → 18}/debug_utils.h +7 -4
- package/src/headers/{12 → 18}/diagnosticfilename-inl.h +0 -0
- package/src/headers/{12 → 18}/env-inl.h +397 -304
- package/src/headers/{12 → 18}/env.h +397 -172
- package/src/headers/{12 → 18}/handle_wrap.h +7 -3
- package/src/headers/18/histogram-inl.h +107 -0
- package/src/headers/18/histogram.h +239 -0
- package/src/headers/{13 → 18}/inspector_agent.h +4 -7
- package/src/headers/{12 → 18}/inspector_io.h +0 -0
- package/src/headers/{13 → 18}/inspector_profiler.h +17 -5
- package/src/headers/{12 → 18}/inspector_socket.h +0 -0
- package/src/headers/{12 → 18}/inspector_socket_server.h +0 -0
- package/src/headers/18/js_native_api.h +571 -0
- package/src/headers/{13 → 18}/js_native_api_types.h +30 -7
- package/src/headers/{12 → 18}/js_native_api_v8.h +220 -83
- package/src/headers/{12 → 18}/js_native_api_v8_internals.h +6 -5
- package/src/headers/{12 → 18}/js_stream.h +0 -0
- package/src/headers/{12 → 18}/json_utils.h +0 -0
- package/src/headers/{13 → 18}/memory_tracker-inl.h +6 -5
- package/src/headers/{13 → 18}/memory_tracker.h +0 -7
- package/src/headers/{13 → 18}/module_wrap.h +24 -7
- package/src/headers/{13 → 18}/node.h +329 -68
- package/src/headers/18/node_api.h +288 -0
- package/src/headers/18/node_api_internals.h +38 -0
- package/src/headers/{12 → 18}/node_api_types.h +12 -9
- package/src/headers/{12 → 18}/node_binding.h +0 -0
- package/src/headers/18/node_blob.h +191 -0
- package/src/headers/18/node_bob-inl.h +37 -0
- package/src/headers/18/node_bob.h +111 -0
- package/src/headers/{13 → 18}/node_buffer.h +0 -0
- package/src/headers/{13 → 18}/node_constants.h +5 -1
- package/src/headers/{12 → 18}/node_context_data.h +5 -0
- package/src/headers/{12 → 18}/node_contextify.h +37 -2
- package/src/headers/{10/node_win32_perfctr_provider.h → 18/node_crypto.h} +30 -31
- package/src/headers/{12 → 18}/node_dir.h +0 -0
- package/src/headers/{12 → 18}/node_dtrace.h +0 -0
- package/src/headers/{12 → 18}/node_errors.h +90 -24
- package/src/headers/18/node_external_reference.h +145 -0
- package/src/headers/{13 → 18}/node_file-inl.h +38 -21
- package/src/headers/{12 → 18}/node_file.h +74 -13
- package/src/headers/{13 → 18}/node_http2.h +365 -269
- package/src/headers/{12 → 18}/node_http2_state.h +40 -50
- package/src/headers/{13 → 18}/node_http_common-inl.h +25 -5
- package/src/headers/{13 → 18}/node_http_common.h +24 -20
- package/src/headers/{13 → 18}/node_i18n.h +2 -1
- package/src/headers/{12 → 18}/node_internals.h +39 -41
- package/src/headers/{13 → 18}/node_main_instance.h +15 -18
- package/src/headers/{12 → 18}/node_mem-inl.h +0 -0
- package/src/headers/{12 → 18}/node_mem.h +1 -1
- package/src/headers/{13 → 18}/node_messaging.h +170 -23
- package/src/headers/{12 → 18}/node_metadata.h +17 -4
- package/src/headers/{12 → 18}/node_mutex.h +77 -1
- package/src/headers/{12 → 18}/node_native_module.h +11 -1
- package/src/headers/{13 → 18}/node_native_module_env.h +14 -8
- package/src/headers/{12 → 18}/node_object_wrap.h +0 -0
- package/src/headers/{13 → 18}/node_options-inl.h +51 -21
- package/src/headers/{13 → 18}/node_options.h +46 -14
- package/src/headers/18/node_perf.h +168 -0
- package/src/headers/{12 → 18}/node_perf_common.h +16 -22
- package/src/headers/{12 → 18}/node_platform.h +21 -16
- package/src/headers/18/node_process-inl.h +26 -0
- package/src/headers/18/node_process.h +97 -0
- package/src/headers/{13 → 18}/node_report.h +2 -2
- package/src/headers/{13 → 18}/node_revert.h +10 -0
- package/src/headers/{12 → 18}/node_root_certs.h +439 -651
- package/src/headers/18/node_snapshot_builder.h +43 -0
- package/src/headers/18/node_snapshotable.h +130 -0
- package/src/headers/{12 → 18}/node_sockaddr-inl.h +100 -4
- package/src/headers/18/node_sockaddr.h +405 -0
- package/src/headers/{12 → 18}/node_stat_watcher.h +7 -1
- package/src/headers/{12 → 18}/node_union_bytes.h +0 -0
- package/src/headers/{13 → 18}/node_url.h +18 -1
- package/src/headers/18/node_v8.h +41 -0
- package/src/headers/{12 → 18}/node_v8_platform-inl.h +10 -0
- package/src/headers/{13 → 18}/node_version.h +7 -7
- package/src/headers/{12 → 18}/node_wasi.h +0 -0
- package/src/headers/18/node_wasm_web_api.h +55 -0
- package/src/headers/{13 → 18}/node_watchdog.h +0 -0
- package/src/headers/{10 → 18}/node_win32_etw_provider-inl.h +7 -6
- package/src/headers/{10 → 18}/node_win32_etw_provider.h +0 -0
- package/src/headers/{13 → 18}/node_worker.h +24 -17
- package/src/headers/{12 → 18}/pipe_wrap.h +2 -0
- package/src/headers/{12 → 18}/req_wrap-inl.h +0 -0
- package/src/headers/{12 → 18}/req_wrap.h +1 -1
- package/src/headers/{12 → 18}/spawn_sync.h +0 -0
- package/src/headers/{13 → 18}/stream_base-inl.h +58 -22
- package/src/headers/{13 → 18}/stream_base.h +29 -3
- package/src/headers/{13 → 18}/stream_pipe.h +8 -3
- package/src/headers/{12 → 18}/stream_wrap.h +4 -1
- package/src/headers/{13 → 18}/string_bytes.h +0 -7
- package/src/headers/{12 → 18}/string_decoder-inl.h +0 -0
- package/src/headers/{10 → 18}/string_decoder.h +0 -0
- package/src/headers/{13 → 18}/string_search.h +2 -2
- package/src/headers/{12 → 18}/tcp_wrap.h +4 -0
- package/src/headers/{12 → 18}/threadpoolwork-inl.h +0 -0
- package/src/headers/18/timer_wrap-inl.h +32 -0
- package/src/headers/18/timer_wrap.h +85 -0
- package/src/headers/{13 → 18}/tracing/agent.h +1 -1
- package/src/headers/{12 → 18}/tracing/node_trace_buffer.h +0 -0
- package/src/headers/{12 → 18}/tracing/node_trace_writer.h +0 -0
- package/src/headers/{13 → 18}/tracing/trace_event.h +23 -13
- package/src/headers/{12 → 18}/tracing/trace_event_common.h +0 -0
- package/src/headers/{12 → 18}/tracing/traced_value.h +0 -0
- package/src/headers/{13 → 18}/tty_wrap.h +2 -1
- package/src/headers/{13 → 18}/udp_wrap.h +5 -0
- package/src/headers/{13 → 18}/util-inl.h +69 -15
- package/src/headers/{13 → 18}/util.h +93 -31
- package/src/headers/18/v8-fast-api-calls.h +939 -0
- package/src/headers/{12 → 18}/v8abbr.h +2 -2
- package/src/headers/10/aliased_buffer.h +0 -241
- package/src/headers/10/async_wrap-inl.h +0 -106
- package/src/headers/10/async_wrap.h +0 -218
- package/src/headers/10/base64.h +0 -197
- package/src/headers/10/base_object-inl.h +0 -132
- package/src/headers/10/base_object.h +0 -115
- package/src/headers/10/connect_wrap.h +0 -28
- package/src/headers/10/connection_wrap.h +0 -30
- package/src/headers/10/debug_utils.h +0 -128
- package/src/headers/10/env-inl.h +0 -906
- package/src/headers/10/env.h +0 -1046
- package/src/headers/10/handle_wrap.h +0 -114
- package/src/headers/10/inspector_agent.h +0 -137
- package/src/headers/10/inspector_io.h +0 -97
- package/src/headers/10/inspector_socket.h +0 -59
- package/src/headers/10/inspector_socket_server.h +0 -104
- package/src/headers/10/js_stream.h +0 -57
- package/src/headers/10/memory_tracker-inl.h +0 -318
- package/src/headers/10/memory_tracker.h +0 -246
- package/src/headers/10/module_wrap.h +0 -100
- package/src/headers/10/node.h +0 -863
- package/src/headers/10/node_api.h +0 -752
- package/src/headers/10/node_api_types.h +0 -171
- package/src/headers/10/node_buffer.h +0 -90
- package/src/headers/10/node_code_cache.h +0 -17
- package/src/headers/10/node_constants.h +0 -74
- package/src/headers/10/node_context_data.h +0 -39
- package/src/headers/10/node_contextify.h +0 -141
- package/src/headers/10/node_counters.h +0 -59
- package/src/headers/10/node_crypto.h +0 -699
- package/src/headers/10/node_crypto_bio.h +0 -177
- package/src/headers/10/node_crypto_clienthello-inl.h +0 -92
- package/src/headers/10/node_crypto_clienthello.h +0 -131
- package/src/headers/10/node_crypto_groups.h +0 -416
- package/src/headers/10/node_dtrace.h +0 -84
- package/src/headers/10/node_errors.h +0 -118
- package/src/headers/10/node_file.h +0 -373
- package/src/headers/10/node_http2.h +0 -1304
- package/src/headers/10/node_http2_state.h +0 -158
- package/src/headers/10/node_i18n.h +0 -69
- package/src/headers/10/node_internals.h +0 -952
- package/src/headers/10/node_javascript.h +0 -41
- package/src/headers/10/node_messaging.h +0 -219
- package/src/headers/10/node_mutex.h +0 -191
- package/src/headers/10/node_object_wrap.h +0 -130
- package/src/headers/10/node_options-inl.h +0 -444
- package/src/headers/10/node_options.h +0 -397
- package/src/headers/10/node_perf.h +0 -134
- package/src/headers/10/node_perf_common.h +0 -96
- package/src/headers/10/node_persistent.h +0 -30
- package/src/headers/10/node_platform.h +0 -170
- package/src/headers/10/node_revert.h +0 -75
- package/src/headers/10/node_root_certs.h +0 -3393
- package/src/headers/10/node_stat_watcher.h +0 -65
- package/src/headers/10/node_url.h +0 -193
- package/src/headers/10/node_version.h +0 -120
- package/src/headers/10/node_watchdog.h +0 -114
- package/src/headers/10/node_worker.h +0 -94
- package/src/headers/10/pipe_wrap.h +0 -76
- package/src/headers/10/req_wrap-inl.h +0 -166
- package/src/headers/10/req_wrap.h +0 -61
- package/src/headers/10/sharedarraybuffer_metadata.h +0 -67
- package/src/headers/10/spawn_sync.h +0 -240
- package/src/headers/10/stream_base-inl.h +0 -458
- package/src/headers/10/stream_base.h +0 -378
- package/src/headers/10/stream_pipe.h +0 -72
- package/src/headers/10/stream_wrap.h +0 -130
- package/src/headers/10/string_bytes.h +0 -126
- package/src/headers/10/string_decoder-inl.h +0 -38
- package/src/headers/10/string_search.h +0 -620
- package/src/headers/10/tcp_wrap.h +0 -99
- package/src/headers/10/tls_wrap.h +0 -195
- package/src/headers/10/tracing/agent.h +0 -178
- package/src/headers/10/tracing/node_trace_buffer.h +0 -83
- package/src/headers/10/tracing/node_trace_writer.h +0 -75
- package/src/headers/10/tracing/trace_event.h +0 -706
- package/src/headers/10/tracing/trace_event_common.h +0 -1102
- package/src/headers/10/tracing/traced_value.h +0 -68
- package/src/headers/10/tty_wrap.h +0 -63
- package/src/headers/10/udp_wrap.h +0 -102
- package/src/headers/10/util-inl.h +0 -459
- package/src/headers/10/util.h +0 -508
- package/src/headers/10/v8abbr.h +0 -121
- package/src/headers/12/aliased_buffer.h +0 -263
- package/src/headers/12/debug_utils.h +0 -181
- package/src/headers/12/histogram-inl.h +0 -83
- package/src/headers/12/histogram.h +0 -98
- package/src/headers/12/http_parser_adaptor.h +0 -24
- package/src/headers/12/inspector_agent.h +0 -147
- package/src/headers/12/inspector_profiler.h +0 -137
- package/src/headers/12/js_native_api.h +0 -541
- package/src/headers/12/js_native_api_types.h +0 -139
- package/src/headers/12/memory_tracker-inl.h +0 -339
- package/src/headers/12/memory_tracker.h +0 -283
- package/src/headers/12/module_wrap.h +0 -99
- package/src/headers/12/node.h +0 -887
- package/src/headers/12/node_api.h +0 -239
- package/src/headers/12/node_buffer.h +0 -92
- package/src/headers/12/node_constants.h +0 -80
- package/src/headers/12/node_crypto.h +0 -800
- package/src/headers/12/node_crypto_bio.h +0 -195
- package/src/headers/12/node_crypto_clienthello-inl.h +0 -91
- package/src/headers/12/node_crypto_clienthello.h +0 -132
- package/src/headers/12/node_file-inl.h +0 -289
- package/src/headers/12/node_http2.h +0 -1311
- package/src/headers/12/node_http_parser_impl.h +0 -994
- package/src/headers/12/node_i18n.h +0 -144
- package/src/headers/12/node_main_instance.h +0 -97
- package/src/headers/12/node_messaging.h +0 -227
- package/src/headers/12/node_native_module_env.h +0 -65
- package/src/headers/12/node_options-inl.h +0 -447
- package/src/headers/12/node_options.h +0 -479
- package/src/headers/12/node_perf.h +0 -181
- package/src/headers/12/node_process.h +0 -41
- package/src/headers/12/node_report.h +0 -47
- package/src/headers/12/node_revert.h +0 -78
- package/src/headers/12/node_sockaddr.h +0 -123
- package/src/headers/12/node_url.h +0 -188
- package/src/headers/12/node_version.h +0 -98
- package/src/headers/12/node_watchdog.h +0 -152
- package/src/headers/12/node_win32_etw_provider-inl.h +0 -287
- package/src/headers/12/node_win32_etw_provider.h +0 -99
- package/src/headers/12/node_worker.h +0 -142
- package/src/headers/12/sharedarraybuffer_metadata.h +0 -72
- package/src/headers/12/stream_base-inl.h +0 -323
- package/src/headers/12/stream_base.h +0 -431
- package/src/headers/12/stream_pipe.h +0 -72
- package/src/headers/12/string_bytes.h +0 -142
- package/src/headers/12/string_decoder.h +0 -50
- package/src/headers/12/string_search.h +0 -638
- package/src/headers/12/tls_wrap.h +0 -221
- package/src/headers/12/tracing/agent.h +0 -195
- package/src/headers/12/tracing/trace_event.h +0 -710
- package/src/headers/12/tty_wrap.h +0 -64
- package/src/headers/12/udp_wrap.h +0 -222
- package/src/headers/12/util-inl.h +0 -529
- package/src/headers/12/util.h +0 -765
- package/src/headers/13/async_wrap-inl.h +0 -94
- package/src/headers/13/async_wrap.h +0 -224
- package/src/headers/13/base64.h +0 -197
- package/src/headers/13/base_object-inl.h +0 -353
- package/src/headers/13/base_object.h +0 -229
- package/src/headers/13/connect_wrap.h +0 -26
- package/src/headers/13/connection_wrap.h +0 -30
- package/src/headers/13/debug_utils-inl.h +0 -223
- package/src/headers/13/diagnosticfilename-inl.h +0 -33
- package/src/headers/13/env-inl.h +0 -1293
- package/src/headers/13/env.h +0 -1469
- package/src/headers/13/handle_wrap.h +0 -117
- package/src/headers/13/histogram-inl.h +0 -83
- package/src/headers/13/histogram.h +0 -98
- package/src/headers/13/inspector_io.h +0 -78
- package/src/headers/13/inspector_socket.h +0 -60
- package/src/headers/13/inspector_socket_server.h +0 -110
- package/src/headers/13/js_native_api.h +0 -541
- package/src/headers/13/js_native_api_v8.h +0 -303
- package/src/headers/13/js_native_api_v8_internals.h +0 -38
- package/src/headers/13/js_stream.h +0 -52
- package/src/headers/13/json_utils.h +0 -160
- package/src/headers/13/node_api.h +0 -239
- package/src/headers/13/node_api_types.h +0 -44
- package/src/headers/13/node_binding.h +0 -99
- package/src/headers/13/node_context_data.h +0 -39
- package/src/headers/13/node_contextify.h +0 -161
- package/src/headers/13/node_crypto.h +0 -800
- package/src/headers/13/node_crypto_common.h +0 -138
- package/src/headers/13/node_crypto_groups.h +0 -415
- package/src/headers/13/node_dir.h +0 -52
- package/src/headers/13/node_dtrace.h +0 -86
- package/src/headers/13/node_errors.h +0 -210
- package/src/headers/13/node_file.h +0 -364
- package/src/headers/13/node_http2_state.h +0 -144
- package/src/headers/13/node_internals.h +0 -405
- package/src/headers/13/node_mem-inl.h +0 -112
- package/src/headers/13/node_mem.h +0 -41
- package/src/headers/13/node_metadata.h +0 -109
- package/src/headers/13/node_mutex.h +0 -247
- package/src/headers/13/node_native_module.h +0 -99
- package/src/headers/13/node_object_wrap.h +0 -132
- package/src/headers/13/node_perf.h +0 -181
- package/src/headers/13/node_perf_common.h +0 -97
- package/src/headers/13/node_platform.h +0 -190
- package/src/headers/13/node_process.h +0 -41
- package/src/headers/13/node_root_certs.h +0 -3424
- package/src/headers/13/node_sockaddr-inl.h +0 -170
- package/src/headers/13/node_sockaddr.h +0 -123
- package/src/headers/13/node_stat_watcher.h +0 -66
- package/src/headers/13/node_union_bytes.h +0 -103
- package/src/headers/13/node_v8_platform-inl.h +0 -184
- package/src/headers/13/node_wasi.h +0 -108
- package/src/headers/13/node_win32_etw_provider-inl.h +0 -287
- package/src/headers/13/node_win32_etw_provider.h +0 -99
- package/src/headers/13/pipe_wrap.h +0 -78
- package/src/headers/13/req_wrap-inl.h +0 -170
- package/src/headers/13/req_wrap.h +0 -77
- package/src/headers/13/spawn_sync.h +0 -242
- package/src/headers/13/stream_wrap.h +0 -130
- package/src/headers/13/string_decoder-inl.h +0 -37
- package/src/headers/13/string_decoder.h +0 -50
- package/src/headers/13/tcp_wrap.h +0 -101
- package/src/headers/13/threadpoolwork-inl.h +0 -57
- package/src/headers/13/tracing/node_trace_buffer.h +0 -83
- package/src/headers/13/tracing/node_trace_writer.h +0 -75
- package/src/headers/13/tracing/trace_event_common.h +0 -1109
- package/src/headers/13/tracing/traced_value.h +0 -70
- package/src/headers/13/v8abbr.h +0 -124
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_ALIASED_BUFFER_H_
|
|
2
|
-
#define SRC_ALIASED_BUFFER_H_
|
|
3
|
-
|
|
4
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
-
|
|
6
|
-
#include <cinttypes>
|
|
7
|
-
#include "util-inl.h"
|
|
8
|
-
#include "v8.h"
|
|
9
|
-
|
|
10
|
-
namespace node {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Do not use this class directly when creating instances of it - use the
|
|
14
|
-
* Aliased*Array defined at the end of this file instead.
|
|
15
|
-
*
|
|
16
|
-
* This class encapsulates the technique of having a native buffer mapped to
|
|
17
|
-
* a JS object. Writes to the native buffer can happen efficiently without
|
|
18
|
-
* going through JS, and the data is then available to user's via the exposed
|
|
19
|
-
* JS object.
|
|
20
|
-
*
|
|
21
|
-
* While this technique is computationally efficient, it is effectively a
|
|
22
|
-
* write to JS program state w/out going through the standard
|
|
23
|
-
* (monitored) API. Thus any VM capabilities to detect the modification are
|
|
24
|
-
* circumvented.
|
|
25
|
-
*
|
|
26
|
-
* The encapsulation herein provides a placeholder where such writes can be
|
|
27
|
-
* observed. Any notification APIs will be left as a future exercise.
|
|
28
|
-
*/
|
|
29
|
-
template <class NativeT,
|
|
30
|
-
class V8T,
|
|
31
|
-
// SFINAE NativeT to be scalar
|
|
32
|
-
typename = std::enable_if_t<std::is_scalar<NativeT>::value>>
|
|
33
|
-
class AliasedBufferBase {
|
|
34
|
-
public:
|
|
35
|
-
AliasedBufferBase(v8::Isolate* isolate, const size_t count)
|
|
36
|
-
: isolate_(isolate), count_(count), byte_offset_(0) {
|
|
37
|
-
CHECK_GT(count, 0);
|
|
38
|
-
const v8::HandleScope handle_scope(isolate_);
|
|
39
|
-
const size_t size_in_bytes =
|
|
40
|
-
MultiplyWithOverflowCheck(sizeof(NativeT), count);
|
|
41
|
-
|
|
42
|
-
// allocate v8 ArrayBuffer
|
|
43
|
-
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(
|
|
44
|
-
isolate_, size_in_bytes);
|
|
45
|
-
buffer_ = static_cast<NativeT*>(ab->GetContents().Data());
|
|
46
|
-
|
|
47
|
-
// allocate v8 TypedArray
|
|
48
|
-
v8::Local<V8T> js_array = V8T::New(ab, byte_offset_, count);
|
|
49
|
-
js_array_ = v8::Global<V8T>(isolate, js_array);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Create an AliasedBufferBase over a sub-region of another aliased buffer.
|
|
54
|
-
* The two will share a v8::ArrayBuffer instance &
|
|
55
|
-
* a native buffer, but will each read/write to different sections of the
|
|
56
|
-
* native buffer.
|
|
57
|
-
*
|
|
58
|
-
* Note that byte_offset must by aligned by sizeof(NativeT).
|
|
59
|
-
*/
|
|
60
|
-
// TODO(refack): refactor into a non-owning `AliasedBufferBaseView`
|
|
61
|
-
AliasedBufferBase(
|
|
62
|
-
v8::Isolate* isolate,
|
|
63
|
-
const size_t byte_offset,
|
|
64
|
-
const size_t count,
|
|
65
|
-
const AliasedBufferBase<uint8_t, v8::Uint8Array>& backing_buffer)
|
|
66
|
-
: isolate_(isolate), count_(count), byte_offset_(byte_offset) {
|
|
67
|
-
const v8::HandleScope handle_scope(isolate_);
|
|
68
|
-
|
|
69
|
-
v8::Local<v8::ArrayBuffer> ab = backing_buffer.GetArrayBuffer();
|
|
70
|
-
|
|
71
|
-
// validate that the byte_offset is aligned with sizeof(NativeT)
|
|
72
|
-
CHECK_EQ(byte_offset & (sizeof(NativeT) - 1), 0);
|
|
73
|
-
// validate this fits inside the backing buffer
|
|
74
|
-
CHECK_LE(MultiplyWithOverflowCheck(sizeof(NativeT), count),
|
|
75
|
-
ab->ByteLength() - byte_offset);
|
|
76
|
-
|
|
77
|
-
buffer_ = reinterpret_cast<NativeT*>(
|
|
78
|
-
const_cast<uint8_t*>(backing_buffer.GetNativeBuffer() + byte_offset));
|
|
79
|
-
|
|
80
|
-
v8::Local<V8T> js_array = V8T::New(ab, byte_offset, count);
|
|
81
|
-
js_array_ = v8::Global<V8T>(isolate, js_array);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
AliasedBufferBase(const AliasedBufferBase& that)
|
|
85
|
-
: isolate_(that.isolate_),
|
|
86
|
-
count_(that.count_),
|
|
87
|
-
byte_offset_(that.byte_offset_),
|
|
88
|
-
buffer_(that.buffer_) {
|
|
89
|
-
js_array_ = v8::Global<V8T>(that.isolate_, that.GetJSArray());
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
AliasedBufferBase& operator=(AliasedBufferBase&& that) noexcept {
|
|
93
|
-
this->~AliasedBufferBase();
|
|
94
|
-
isolate_ = that.isolate_;
|
|
95
|
-
count_ = that.count_;
|
|
96
|
-
byte_offset_ = that.byte_offset_;
|
|
97
|
-
buffer_ = that.buffer_;
|
|
98
|
-
|
|
99
|
-
js_array_.Reset(isolate_, that.js_array_.Get(isolate_));
|
|
100
|
-
|
|
101
|
-
that.buffer_ = nullptr;
|
|
102
|
-
that.js_array_.Reset();
|
|
103
|
-
return *this;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Helper class that is returned from operator[] to support assignment into
|
|
108
|
-
* a specified location.
|
|
109
|
-
*/
|
|
110
|
-
class Reference {
|
|
111
|
-
public:
|
|
112
|
-
Reference(AliasedBufferBase<NativeT, V8T>* aliased_buffer, size_t index)
|
|
113
|
-
: aliased_buffer_(aliased_buffer), index_(index) {}
|
|
114
|
-
|
|
115
|
-
Reference(const Reference& that)
|
|
116
|
-
: aliased_buffer_(that.aliased_buffer_),
|
|
117
|
-
index_(that.index_) {
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
inline Reference& operator=(const NativeT& val) {
|
|
121
|
-
aliased_buffer_->SetValue(index_, val);
|
|
122
|
-
return *this;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
inline Reference& operator=(const Reference& val) {
|
|
126
|
-
return *this = static_cast<NativeT>(val);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
operator NativeT() const {
|
|
130
|
-
return aliased_buffer_->GetValue(index_);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
inline Reference& operator+=(const NativeT& val) {
|
|
134
|
-
const NativeT current = aliased_buffer_->GetValue(index_);
|
|
135
|
-
aliased_buffer_->SetValue(index_, current + val);
|
|
136
|
-
return *this;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
inline Reference& operator+=(const Reference& val) {
|
|
140
|
-
return this->operator+=(static_cast<NativeT>(val));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
inline Reference& operator-=(const NativeT& val) {
|
|
144
|
-
const NativeT current = aliased_buffer_->GetValue(index_);
|
|
145
|
-
aliased_buffer_->SetValue(index_, current - val);
|
|
146
|
-
return *this;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private:
|
|
150
|
-
AliasedBufferBase<NativeT, V8T>* aliased_buffer_;
|
|
151
|
-
size_t index_;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Get the underlying v8 TypedArray overlayed on top of the native buffer
|
|
156
|
-
*/
|
|
157
|
-
v8::Local<V8T> GetJSArray() const {
|
|
158
|
-
return js_array_.Get(isolate_);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Get the underlying v8::ArrayBuffer underlying the TypedArray and
|
|
163
|
-
* overlaying the native buffer
|
|
164
|
-
*/
|
|
165
|
-
v8::Local<v8::ArrayBuffer> GetArrayBuffer() const {
|
|
166
|
-
return GetJSArray()->Buffer();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Get the underlying native buffer. Note that all reads/writes should occur
|
|
171
|
-
* through the GetValue/SetValue/operator[] methods
|
|
172
|
-
*/
|
|
173
|
-
inline const NativeT* GetNativeBuffer() const {
|
|
174
|
-
return buffer_;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Synonym for GetBuffer()
|
|
179
|
-
*/
|
|
180
|
-
inline const NativeT* operator * () const {
|
|
181
|
-
return GetNativeBuffer();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Set position index to given value.
|
|
186
|
-
*/
|
|
187
|
-
inline void SetValue(const size_t index, NativeT value) {
|
|
188
|
-
DCHECK_LT(index, count_);
|
|
189
|
-
buffer_[index] = value;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Get value at position index
|
|
194
|
-
*/
|
|
195
|
-
inline const NativeT GetValue(const size_t index) const {
|
|
196
|
-
DCHECK_LT(index, count_);
|
|
197
|
-
return buffer_[index];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Effectively, a synonym for GetValue/SetValue
|
|
202
|
-
*/
|
|
203
|
-
Reference operator[](size_t index) {
|
|
204
|
-
return Reference(this, index);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
NativeT operator[](size_t index) const {
|
|
208
|
-
return GetValue(index);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
size_t Length() const {
|
|
212
|
-
return count_;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Should only be used to extend the array.
|
|
216
|
-
// Should only be used on an owning array, not one created as a sub array of
|
|
217
|
-
// an owning `AliasedBufferBase`.
|
|
218
|
-
void reserve(size_t new_capacity) {
|
|
219
|
-
DCHECK_GE(new_capacity, count_);
|
|
220
|
-
DCHECK_EQ(byte_offset_, 0);
|
|
221
|
-
const v8::HandleScope handle_scope(isolate_);
|
|
222
|
-
|
|
223
|
-
const size_t old_size_in_bytes = sizeof(NativeT) * count_;
|
|
224
|
-
const size_t new_size_in_bytes = MultiplyWithOverflowCheck(sizeof(NativeT),
|
|
225
|
-
new_capacity);
|
|
226
|
-
|
|
227
|
-
// allocate v8 new ArrayBuffer
|
|
228
|
-
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(
|
|
229
|
-
isolate_, new_size_in_bytes);
|
|
230
|
-
|
|
231
|
-
// allocate new native buffer
|
|
232
|
-
NativeT* new_buffer = static_cast<NativeT*>(ab->GetContents().Data());
|
|
233
|
-
// copy old content
|
|
234
|
-
memcpy(new_buffer, buffer_, old_size_in_bytes);
|
|
235
|
-
|
|
236
|
-
// allocate v8 TypedArray
|
|
237
|
-
v8::Local<V8T> js_array = V8T::New(ab, byte_offset_, new_capacity);
|
|
238
|
-
|
|
239
|
-
// move over old v8 TypedArray
|
|
240
|
-
js_array_ = std::move(v8::Global<V8T>(isolate_, js_array));
|
|
241
|
-
|
|
242
|
-
buffer_ = new_buffer;
|
|
243
|
-
count_ = new_capacity;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
private:
|
|
247
|
-
v8::Isolate* isolate_;
|
|
248
|
-
size_t count_;
|
|
249
|
-
size_t byte_offset_;
|
|
250
|
-
NativeT* buffer_;
|
|
251
|
-
v8::Global<V8T> js_array_;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
typedef AliasedBufferBase<int32_t, v8::Int32Array> AliasedInt32Array;
|
|
255
|
-
typedef AliasedBufferBase<uint8_t, v8::Uint8Array> AliasedUint8Array;
|
|
256
|
-
typedef AliasedBufferBase<uint32_t, v8::Uint32Array> AliasedUint32Array;
|
|
257
|
-
typedef AliasedBufferBase<double, v8::Float64Array> AliasedFloat64Array;
|
|
258
|
-
typedef AliasedBufferBase<uint64_t, v8::BigUint64Array> AliasedBigUint64Array;
|
|
259
|
-
} // namespace node
|
|
260
|
-
|
|
261
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
262
|
-
|
|
263
|
-
#endif // SRC_ALIASED_BUFFER_H_
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_DEBUG_UTILS_H_
|
|
2
|
-
#define SRC_DEBUG_UTILS_H_
|
|
3
|
-
|
|
4
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
-
|
|
6
|
-
#include "async_wrap.h"
|
|
7
|
-
|
|
8
|
-
#include <algorithm>
|
|
9
|
-
#include <sstream>
|
|
10
|
-
#include <string>
|
|
11
|
-
|
|
12
|
-
// Use FORCE_INLINE on functions that have a debug-category-enabled check first
|
|
13
|
-
// and then ideally only a single function call following it, to maintain
|
|
14
|
-
// performance for the common case (no debugging used).
|
|
15
|
-
#ifdef __GNUC__
|
|
16
|
-
#define FORCE_INLINE __attribute__((always_inline))
|
|
17
|
-
#define COLD_NOINLINE __attribute__((cold, noinline))
|
|
18
|
-
#else
|
|
19
|
-
#define FORCE_INLINE
|
|
20
|
-
#define COLD_NOINLINE
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
|
-
namespace node {
|
|
24
|
-
class Environment;
|
|
25
|
-
|
|
26
|
-
template <typename T>
|
|
27
|
-
inline std::string ToString(const T& value);
|
|
28
|
-
|
|
29
|
-
// C++-style variant of sprintf()/fprintf() that:
|
|
30
|
-
// - Returns an std::string
|
|
31
|
-
// - Handles \0 bytes correctly
|
|
32
|
-
// - Supports %p and %s. %d, %i and %u are aliases for %s.
|
|
33
|
-
// - Accepts any class that has a ToString() method for stringification.
|
|
34
|
-
template <typename... Args>
|
|
35
|
-
inline std::string SPrintF(const char* format, Args&&... args);
|
|
36
|
-
template <typename... Args>
|
|
37
|
-
inline void FPrintF(FILE* file, const char* format, Args&&... args);
|
|
38
|
-
void FWrite(FILE* file, const std::string& str);
|
|
39
|
-
|
|
40
|
-
// Listing the AsyncWrap provider types first enables us to cast directly
|
|
41
|
-
// from a provider type to a debug category.
|
|
42
|
-
#define DEBUG_CATEGORY_NAMES(V) \
|
|
43
|
-
NODE_ASYNC_PROVIDER_TYPES(V) \
|
|
44
|
-
V(HUGEPAGES) \
|
|
45
|
-
V(INSPECTOR_SERVER) \
|
|
46
|
-
V(INSPECTOR_PROFILER) \
|
|
47
|
-
V(CODE_CACHE) \
|
|
48
|
-
V(WASI)
|
|
49
|
-
|
|
50
|
-
enum class DebugCategory {
|
|
51
|
-
#define V(name) name,
|
|
52
|
-
DEBUG_CATEGORY_NAMES(V)
|
|
53
|
-
#undef V
|
|
54
|
-
CATEGORY_COUNT
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
class EnabledDebugList {
|
|
58
|
-
public:
|
|
59
|
-
bool enabled(DebugCategory category) const {
|
|
60
|
-
DCHECK_GE(static_cast<int>(category), 0);
|
|
61
|
-
DCHECK_LT(static_cast<int>(category),
|
|
62
|
-
static_cast<int>(DebugCategory::CATEGORY_COUNT));
|
|
63
|
-
return enabled_[static_cast<int>(category)];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Uses NODE_DEBUG_NATIVE to initialize the categories. When env is not a
|
|
67
|
-
// nullptr, the environment variables set in the Environment are used.
|
|
68
|
-
// Otherwise the system environment variables are used.
|
|
69
|
-
void Parse(Environment* env);
|
|
70
|
-
|
|
71
|
-
private:
|
|
72
|
-
// Set all categories matching cats to the value of enabled.
|
|
73
|
-
void Parse(const std::string& cats, bool enabled);
|
|
74
|
-
void set_enabled(DebugCategory category, bool enabled) {
|
|
75
|
-
DCHECK_GE(static_cast<int>(category), 0);
|
|
76
|
-
DCHECK_LT(static_cast<int>(category),
|
|
77
|
-
static_cast<int>(DebugCategory::CATEGORY_COUNT));
|
|
78
|
-
enabled_[static_cast<int>(category)] = true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
bool enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = {false};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
template <typename... Args>
|
|
85
|
-
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
86
|
-
DebugCategory cat,
|
|
87
|
-
const char* format,
|
|
88
|
-
Args&&... args);
|
|
89
|
-
|
|
90
|
-
inline void FORCE_INLINE Debug(EnabledDebugList* list,
|
|
91
|
-
DebugCategory cat,
|
|
92
|
-
const char* message);
|
|
93
|
-
|
|
94
|
-
template <typename... Args>
|
|
95
|
-
inline void FORCE_INLINE
|
|
96
|
-
Debug(Environment* env, DebugCategory cat, const char* format, Args&&... args);
|
|
97
|
-
|
|
98
|
-
inline void FORCE_INLINE Debug(Environment* env,
|
|
99
|
-
DebugCategory cat,
|
|
100
|
-
const char* message);
|
|
101
|
-
|
|
102
|
-
template <typename... Args>
|
|
103
|
-
inline void Debug(Environment* env,
|
|
104
|
-
DebugCategory cat,
|
|
105
|
-
const std::string& format,
|
|
106
|
-
Args&&... args);
|
|
107
|
-
|
|
108
|
-
// Used internally by the 'real' Debug(AsyncWrap*, ...) functions below, so that
|
|
109
|
-
// the FORCE_INLINE flag on them doesn't apply to the contents of this function
|
|
110
|
-
// as well.
|
|
111
|
-
// We apply COLD_NOINLINE to tell the compiler that it's not worth optimizing
|
|
112
|
-
// this function for speed and it should rather focus on keeping it out of
|
|
113
|
-
// hot code paths. In particular, we want to keep the string concatenating code
|
|
114
|
-
// out of the function containing the original `Debug()` call.
|
|
115
|
-
template <typename... Args>
|
|
116
|
-
void COLD_NOINLINE UnconditionalAsyncWrapDebug(AsyncWrap* async_wrap,
|
|
117
|
-
const char* format,
|
|
118
|
-
Args&&... args);
|
|
119
|
-
|
|
120
|
-
template <typename... Args>
|
|
121
|
-
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
122
|
-
const char* format,
|
|
123
|
-
Args&&... args);
|
|
124
|
-
|
|
125
|
-
template <typename... Args>
|
|
126
|
-
inline void FORCE_INLINE Debug(AsyncWrap* async_wrap,
|
|
127
|
-
const std::string& format,
|
|
128
|
-
Args&&... args);
|
|
129
|
-
|
|
130
|
-
// Debug helper for inspecting the currently running `node` executable.
|
|
131
|
-
class NativeSymbolDebuggingContext {
|
|
132
|
-
public:
|
|
133
|
-
static std::unique_ptr<NativeSymbolDebuggingContext> New();
|
|
134
|
-
|
|
135
|
-
class SymbolInfo {
|
|
136
|
-
public:
|
|
137
|
-
std::string name;
|
|
138
|
-
std::string filename;
|
|
139
|
-
size_t line = 0;
|
|
140
|
-
size_t dis = 0;
|
|
141
|
-
|
|
142
|
-
std::string Display() const;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
NativeSymbolDebuggingContext() = default;
|
|
146
|
-
virtual ~NativeSymbolDebuggingContext() = default;
|
|
147
|
-
|
|
148
|
-
virtual SymbolInfo LookupSymbol(void* address) { return {}; }
|
|
149
|
-
virtual bool IsMapped(void* address) { return false; }
|
|
150
|
-
virtual int GetStackTrace(void** frames, int count) { return 0; }
|
|
151
|
-
|
|
152
|
-
NativeSymbolDebuggingContext(const NativeSymbolDebuggingContext&) = delete;
|
|
153
|
-
NativeSymbolDebuggingContext(NativeSymbolDebuggingContext&&) = delete;
|
|
154
|
-
NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&)
|
|
155
|
-
= delete;
|
|
156
|
-
NativeSymbolDebuggingContext operator=(NativeSymbolDebuggingContext&&)
|
|
157
|
-
= delete;
|
|
158
|
-
static std::vector<std::string> GetLoadedLibraries();
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// Variant of `uv_loop_close` that tries to be as helpful as possible
|
|
162
|
-
// about giving information on currently existing handles, if there are any,
|
|
163
|
-
// but still aborts the process.
|
|
164
|
-
void CheckedUvLoopClose(uv_loop_t* loop);
|
|
165
|
-
void PrintLibuvHandleInformation(uv_loop_t* loop, FILE* stream);
|
|
166
|
-
|
|
167
|
-
namespace per_process {
|
|
168
|
-
extern EnabledDebugList enabled_debug_list;
|
|
169
|
-
|
|
170
|
-
template <typename... Args>
|
|
171
|
-
inline void FORCE_INLINE Debug(DebugCategory cat,
|
|
172
|
-
const char* format,
|
|
173
|
-
Args&&... args);
|
|
174
|
-
|
|
175
|
-
inline void FORCE_INLINE Debug(DebugCategory cat, const char* message);
|
|
176
|
-
} // namespace per_process
|
|
177
|
-
} // namespace node
|
|
178
|
-
|
|
179
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
180
|
-
|
|
181
|
-
#endif // SRC_DEBUG_UTILS_H_
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_HISTOGRAM_INL_H_
|
|
2
|
-
#define SRC_HISTOGRAM_INL_H_
|
|
3
|
-
|
|
4
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
-
|
|
6
|
-
#include "histogram.h"
|
|
7
|
-
#include "base_object-inl.h"
|
|
8
|
-
#include "node_internals.h"
|
|
9
|
-
|
|
10
|
-
namespace node {
|
|
11
|
-
|
|
12
|
-
void Histogram::Reset() {
|
|
13
|
-
hdr_reset(histogram_.get());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
bool Histogram::Record(int64_t value) {
|
|
17
|
-
return hdr_record_value(histogram_.get(), value);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
int64_t Histogram::Min() {
|
|
21
|
-
return hdr_min(histogram_.get());
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
int64_t Histogram::Max() {
|
|
25
|
-
return hdr_max(histogram_.get());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
double Histogram::Mean() {
|
|
29
|
-
return hdr_mean(histogram_.get());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
double Histogram::Stddev() {
|
|
33
|
-
return hdr_stddev(histogram_.get());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
double Histogram::Percentile(double percentile) {
|
|
37
|
-
CHECK_GT(percentile, 0);
|
|
38
|
-
CHECK_LE(percentile, 100);
|
|
39
|
-
return static_cast<double>(
|
|
40
|
-
hdr_value_at_percentile(histogram_.get(), percentile));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
template <typename Iterator>
|
|
44
|
-
void Histogram::Percentiles(Iterator&& fn) {
|
|
45
|
-
hdr_iter iter;
|
|
46
|
-
hdr_iter_percentile_init(&iter, histogram_.get(), 1);
|
|
47
|
-
while (hdr_iter_next(&iter)) {
|
|
48
|
-
double key = iter.specifics.percentiles.percentile;
|
|
49
|
-
double value = static_cast<double>(iter.value);
|
|
50
|
-
fn(key, value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
bool HistogramBase::RecordDelta() {
|
|
55
|
-
uint64_t time = uv_hrtime();
|
|
56
|
-
bool ret = true;
|
|
57
|
-
if (prev_ > 0) {
|
|
58
|
-
int64_t delta = time - prev_;
|
|
59
|
-
if (delta > 0) {
|
|
60
|
-
ret = Record(delta);
|
|
61
|
-
TraceDelta(delta);
|
|
62
|
-
if (!ret) {
|
|
63
|
-
if (exceeds_ < 0xFFFFFFFF)
|
|
64
|
-
exceeds_++;
|
|
65
|
-
TraceExceeds(delta);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
prev_ = time;
|
|
70
|
-
return ret;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
void HistogramBase::ResetState() {
|
|
74
|
-
Reset();
|
|
75
|
-
exceeds_ = 0;
|
|
76
|
-
prev_ = 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
} // namespace node
|
|
80
|
-
|
|
81
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
82
|
-
|
|
83
|
-
#endif // SRC_HISTOGRAM_INL_H_
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_HISTOGRAM_H_
|
|
2
|
-
#define SRC_HISTOGRAM_H_
|
|
3
|
-
|
|
4
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
-
|
|
6
|
-
#include "hdr_histogram.h"
|
|
7
|
-
#include "base_object.h"
|
|
8
|
-
#include "util.h"
|
|
9
|
-
|
|
10
|
-
#include <functional>
|
|
11
|
-
#include <limits>
|
|
12
|
-
#include <map>
|
|
13
|
-
|
|
14
|
-
namespace node {
|
|
15
|
-
|
|
16
|
-
constexpr int kDefaultHistogramFigures = 3;
|
|
17
|
-
|
|
18
|
-
class Histogram {
|
|
19
|
-
public:
|
|
20
|
-
Histogram(
|
|
21
|
-
int64_t lowest = std::numeric_limits<int64_t>::min(),
|
|
22
|
-
int64_t highest = std::numeric_limits<int64_t>::max(),
|
|
23
|
-
int figures = kDefaultHistogramFigures);
|
|
24
|
-
virtual ~Histogram() = default;
|
|
25
|
-
|
|
26
|
-
inline bool Record(int64_t value);
|
|
27
|
-
inline void Reset();
|
|
28
|
-
inline int64_t Min();
|
|
29
|
-
inline int64_t Max();
|
|
30
|
-
inline double Mean();
|
|
31
|
-
inline double Stddev();
|
|
32
|
-
inline double Percentile(double percentile);
|
|
33
|
-
|
|
34
|
-
// Iterator is a function type that takes two doubles as argument, one for
|
|
35
|
-
// percentile and one for the value at that percentile.
|
|
36
|
-
template <typename Iterator>
|
|
37
|
-
inline void Percentiles(Iterator&& fn);
|
|
38
|
-
|
|
39
|
-
size_t GetMemorySize() const {
|
|
40
|
-
return hdr_get_memory_size(histogram_.get());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private:
|
|
44
|
-
using HistogramPointer = DeleteFnPtr<hdr_histogram, hdr_close>;
|
|
45
|
-
HistogramPointer histogram_;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
class HistogramBase : public BaseObject, public Histogram {
|
|
49
|
-
public:
|
|
50
|
-
virtual ~HistogramBase() = default;
|
|
51
|
-
|
|
52
|
-
virtual void TraceDelta(int64_t delta) {}
|
|
53
|
-
virtual void TraceExceeds(int64_t delta) {}
|
|
54
|
-
|
|
55
|
-
inline bool RecordDelta();
|
|
56
|
-
inline void ResetState();
|
|
57
|
-
|
|
58
|
-
int64_t Exceeds() const { return exceeds_; }
|
|
59
|
-
|
|
60
|
-
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
61
|
-
SET_MEMORY_INFO_NAME(HistogramBase)
|
|
62
|
-
SET_SELF_SIZE(HistogramBase)
|
|
63
|
-
|
|
64
|
-
static void GetMin(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
65
|
-
static void GetMax(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
66
|
-
static void GetMean(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
67
|
-
static void GetExceeds(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
68
|
-
static void GetStddev(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
69
|
-
static void GetPercentile(
|
|
70
|
-
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
71
|
-
static void GetPercentiles(
|
|
72
|
-
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
73
|
-
static void DoReset(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
74
|
-
static void Initialize(Environment* env);
|
|
75
|
-
|
|
76
|
-
static BaseObjectPtr<HistogramBase> New(
|
|
77
|
-
Environment* env,
|
|
78
|
-
int64_t lowest = std::numeric_limits<int64_t>::min(),
|
|
79
|
-
int64_t highest = std::numeric_limits<int64_t>::max(),
|
|
80
|
-
int figures = kDefaultHistogramFigures);
|
|
81
|
-
|
|
82
|
-
HistogramBase(
|
|
83
|
-
Environment* env,
|
|
84
|
-
v8::Local<v8::Object> wrap,
|
|
85
|
-
int64_t lowest = std::numeric_limits<int64_t>::min(),
|
|
86
|
-
int64_t highest = std::numeric_limits<int64_t>::max(),
|
|
87
|
-
int figures = kDefaultHistogramFigures);
|
|
88
|
-
|
|
89
|
-
private:
|
|
90
|
-
int64_t exceeds_ = 0;
|
|
91
|
-
uint64_t prev_ = 0;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
} // namespace node
|
|
95
|
-
|
|
96
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
97
|
-
|
|
98
|
-
#endif // SRC_HISTOGRAM_H_
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_HTTP_PARSER_ADAPTOR_H_
|
|
2
|
-
#define SRC_HTTP_PARSER_ADAPTOR_H_
|
|
3
|
-
|
|
4
|
-
#ifdef NODE_EXPERIMENTAL_HTTP
|
|
5
|
-
# include "llhttp.h"
|
|
6
|
-
|
|
7
|
-
typedef llhttp_type_t parser_type_t;
|
|
8
|
-
typedef llhttp_errno_t parser_errno_t;
|
|
9
|
-
typedef llhttp_settings_t parser_settings_t;
|
|
10
|
-
typedef llhttp_t parser_t;
|
|
11
|
-
|
|
12
|
-
#else /* !NODE_EXPERIMENTAL_HTTP */
|
|
13
|
-
# include "http_parser.h"
|
|
14
|
-
|
|
15
|
-
typedef enum http_parser_type parser_type_t;
|
|
16
|
-
typedef enum http_errno parser_errno_t;
|
|
17
|
-
typedef http_parser_settings parser_settings_t;
|
|
18
|
-
typedef http_parser parser_t;
|
|
19
|
-
|
|
20
|
-
#define HPE_USER HPE_UNKNOWN
|
|
21
|
-
|
|
22
|
-
#endif /* NODE_EXPERIMENTAL_HTTP */
|
|
23
|
-
|
|
24
|
-
#endif /* SRC_HTTP_PARSER_ADAPTOR_H_ */
|