| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 32de361 commit 4a88dde
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -651,6 +651,22 @@ performance.mark('test'); | |||
| 651 | 651 | performance.mark('meow'); | |
| 652 | 652 | ``` | |
| 653 | 653 | ||
| 654 | + ## `perf_hooks.createHistogram([options])` | ||
| 655 | + <!-- YAML | ||
| 656 | + added: REPLACEME | ||
| 657 | + --> | ||
| 658 | + | ||
| 659 | + * `options` {Object} | ||
| 660 | + * `min` {number|bigint} The minimum recordable value. Must be an integer | ||
| 661 | + value greater than 0. **Defaults**: `1`. | ||
| 662 | + * `max` {number|bigint} The maximum recordable value. Must be an integer | ||
| 663 | + value greater than `min`. **Defaults**: `Number.MAX_SAFE_INTEGER`. | ||
| 664 | + * `figures` {number} The number of accuracy digits. Must be a number between | ||
| 665 | + `1` and `5`. **Defaults**: `3`. | ||
| 666 | + * Returns {RecordableHistogram} | ||
| 667 | + | ||
| 668 | + Returns a {RecordableHistogram}. | ||
| 669 | + | ||
| 654 | 670 | ## `perf_hooks.monitorEventLoopDelay([options])` | |
| 655 | 671 | <!-- YAML | |
| 656 | 672 | added: v11.10.0 | |
@@ -659,12 +675,12 @@ added: v11.10.0 | |||
| 659 | 675 | * `options` {Object} | |
| 660 | 676 | * `resolution` {number} The sampling rate in milliseconds. Must be greater | |
| 661 | 677 | than zero. **Default:** `10`. | |
| 662 | - * Returns: {Histogram} | ||
| 678 | + * Returns: {IntervalHistogram} | ||
| 663 | 679 | ||
| 664 | 680 | _This property is an extension by Node.js. It is not available in Web browsers._ | |
| 665 | 681 | ||
| 666 | - Creates a `Histogram` object that samples and reports the event loop delay | ||
| 667 | - over time. The delays will be reported in nanoseconds. | ||
| 682 | + Creates an `IntervalHistogram` object that samples and reports the event loop | ||
| 683 | + delay over time. The delays will be reported in nanoseconds. | ||
| 668 | 684 | ||
| 669 | 685 | Using a timer to detect approximate event loop delay works because the | |
| 670 | 686 | execution of timers is tied specifically to the lifecycle of the libuv | |
@@ -687,36 +703,12 @@ console.log(h.percentile(50)); | |||
| 687 | 703 | console.log(h.percentile(99)); | |
| 688 | 704 | ``` | |
| 689 | 705 | ||
| 690 | - ### Class: `Histogram` | ||
| 691 | - <!-- YAML | ||
| 692 | - added: v11.10.0 | ||
| 693 | - --> | ||
| 694 | - Tracks the event loop delay at a given sampling rate. The constructor of | ||
| 695 | - this class not exposed to users. | ||
| 696 | - | ||
| 697 | - _This property is an extension by Node.js. It is not available in Web browsers._ | ||
| 698 | - | ||
| 699 | - #### `histogram.disable()` | ||
| 700 | - <!-- YAML | ||
| 701 | - added: v11.10.0 | ||
| 702 | - --> | ||
| 703 | - | ||
| 704 | - * Returns: {boolean} | ||
| 705 | - | ||
| 706 | - Disables the event loop delay sample timer. Returns `true` if the timer was | ||
| 707 | - stopped, `false` if it was already stopped. | ||
| 708 | - | ||
| 709 | - #### `histogram.enable()` | ||
| 706 | + ## Class: `Histogram` | ||
| 710 | 707 | <!-- YAML | |
| 711 | 708 | added: v11.10.0 | |
| 712 | 709 | --> | |
| 713 | 710 | ||
| 714 | - * Returns: {boolean} | ||
| 715 | - | ||
| 716 | - Enables the event loop delay sample timer. Returns `true` if the timer was | ||
| 717 | - started, `false` if it was already started. | ||
| 718 | - | ||
| 719 | - #### `histogram.exceeds` | ||
| 711 | + ### `histogram.exceeds` | ||
| 720 | 712 | <!-- YAML | |
| 721 | 713 | added: v11.10.0 | |
| 722 | 714 | --> | |
@@ -726,7 +718,7 @@ added: v11.10.0 | |||
| 726 | 718 | The number of times the event loop delay exceeded the maximum 1 hour event | |
| 727 | 719 | loop delay threshold. | |
| 728 | 720 | ||
| 729 | - #### `histogram.max` | ||
| 721 | + ### `histogram.max` | ||
| 730 | 722 | <!-- YAML | |
| 731 | 723 | added: v11.10.0 | |
| 732 | 724 | --> | |
@@ -735,7 +727,7 @@ added: v11.10.0 | |||
| 735 | 727 | ||
| 736 | 728 | The maximum recorded event loop delay. | |
| 737 | 729 | ||
| 738 | - #### `histogram.mean` | ||
| 730 | + ### `histogram.mean` | ||
| 739 | 731 | <!-- YAML | |
| 740 | 732 | added: v11.10.0 | |
| 741 | 733 | --> | |
@@ -744,7 +736,7 @@ added: v11.10.0 | |||
| 744 | 736 | ||
| 745 | 737 | The mean of the recorded event loop delays. | |
| 746 | 738 | ||
| 747 | - #### `histogram.min` | ||
| 739 | + ### `histogram.min` | ||
| 748 | 740 | <!-- YAML | |
| 749 | 741 | added: v11.10.0 | |
| 750 | 742 | --> | |
@@ -753,7 +745,7 @@ added: v11.10.0 | |||
| 753 | 745 | ||
| 754 | 746 | The minimum recorded event loop delay. | |
| 755 | 747 | ||
| 756 | - #### `histogram.percentile(percentile)` | ||
| 748 | + ### `histogram.percentile(percentile)` | ||
| 757 | 749 | <!-- YAML | |
| 758 | 750 | added: v11.10.0 | |
| 759 | 751 | --> | |
@@ -763,7 +755,7 @@ added: v11.10.0 | |||
| 763 | 755 | ||
| 764 | 756 | Returns the value at the given percentile. | |
| 765 | 757 | ||
| 766 | - #### `histogram.percentiles` | ||
| 758 | + ### `histogram.percentiles` | ||
| 767 | 759 | <!-- YAML | |
| 768 | 760 | added: v11.10.0 | |
| 769 | 761 | --> | |
@@ -772,14 +764,14 @@ added: v11.10.0 | |||
| 772 | 764 | ||
| 773 | 765 | Returns a `Map` object detailing the accumulated percentile distribution. | |
| 774 | 766 | ||
| 775 | - #### `histogram.reset()` | ||
| 767 | + ### `histogram.reset()` | ||
| 776 | 768 | <!-- YAML | |
| 777 | 769 | added: v11.10.0 | |
| 778 | 770 | --> | |
| 779 | 771 | ||
| 780 | 772 | Resets the collected histogram data. | |
| 781 | 773 | ||
| 782 | - #### `histogram.stddev` | ||
| 774 | + ### `histogram.stddev` | ||
| 783 | 775 | <!-- YAML | |
| 784 | 776 | added: v11.10.0 | |
| 785 | 777 | --> | |
@@ -788,6 +780,56 @@ added: v11.10.0 | |||
| 788 | 780 | ||
| 789 | 781 | The standard deviation of the recorded event loop delays. | |
| 790 | 782 | ||
| 783 | + ## Class: `IntervalHistogram extends Histogram` | ||
| 784 | + | ||
| 785 | + A `Histogram` that is periodically updated on a given interval. | ||
| 786 | + | ||
| 787 | + ### `histogram.disable()` | ||
| 788 | + <!-- YAML | ||
| 789 | + added: v11.10.0 | ||
| 790 | + --> | ||
| 791 | + | ||
| 792 | + * Returns: {boolean} | ||
| 793 | + | ||
| 794 | + Disables the update interval timer. Returns `true` if the timer was | ||
| 795 | + stopped, `false` if it was already stopped. | ||
| 796 | + | ||
| 797 | + ### `histogram.enable()` | ||
| 798 | + <!-- YAML | ||
| 799 | + added: v11.10.0 | ||
| 800 | + --> | ||
| 801 | + | ||
| 802 | + * Returns: {boolean} | ||
| 803 | + | ||
| 804 | + Enables the update interval timer. Returns `true` if the timer was | ||
| 805 | + started, `false` if it was already started. | ||
| 806 | + | ||
| 807 | + ### Cloning an `IntervalHistogram` | ||
| 808 | + | ||
| 809 | + {IntervalHistogram} instances can be cloned via {MessagePort}. On the receiving | ||
| 810 | + end, the histogram is cloned as a plain {Histogram} object that does not | ||
| 811 | + implement the `enable()` and `disable()` methods. | ||
| 812 | + | ||
| 813 | + ## Class: `RecordableHistogram extends Histogram` | ||
| 814 | + <!-- YAML | ||
| 815 | + added: REPLACEME | ||
| 816 | + --> | ||
| 817 | + | ||
| 818 | + ### `histogram.record(val)` | ||
| 819 | + <!-- YAML | ||
| 820 | + added: REPLACEME | ||
| 821 | + --> | ||
| 822 | + | ||
| 823 | + * `val` {number|bigint} The amount to record in the histogram. | ||
| 824 | + | ||
| 825 | + ### `histogram.recordDelta()` | ||
| 826 | + <!-- YAML | ||
| 827 | + added: REPLACEME | ||
| 828 | + --> | ||
| 829 | + | ||
| 830 | + Calculates the amount of time (in nanoseconds) that has passed since the | ||
| 831 | + previous call to `recordDelta()` and records that amount in the histogram. | ||
| 832 | + | ||
| 791 | 833 | ## Examples | |
| 792 | 834 | ||
| 793 | 835 | ### Measuring the duration of async operations | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -381,6 +381,9 @@ changes: | |||
| 381 | 381 | - version: REPLACEME | |
| 382 | 382 | pr-url: https://github.com/nodejs/node/pull/37917 | |
| 383 | 383 | description: Add 'BlockList' to the list of cloneable types. | |
| 384 | + - version: REPLACEME | ||
| 385 | + pr-url: https://github.com/nodejs/node/pull/37155 | ||
| 386 | + description: Add 'Histogram' types to the list of cloneable types. | ||
| 384 | 387 | - version: v14.5.0 | |
| 385 | 388 | pr-url: https://github.com/nodejs/node/pull/33360 | |
| 386 | 389 | description: Added `KeyObject` to the list of cloneable types. | |
@@ -406,6 +409,7 @@ In particular, the significant differences to `JSON` are: | |||
| 406 | 409 | * `value` may contain [`WebAssembly.Module`][] instances. | |
| 407 | 410 | * `value` may not contain native (C++-backed) objects other than: | |
| 408 | 411 | * {FileHandle}s, | |
| 412 | + * {Histogram}s, | ||
| 409 | 413 | * {KeyObject}s, | |
| 410 | 414 | * {MessagePort}s, | |
| 411 | 415 | * {net.BlockList}s, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments