_getRecentPerformanceSamples.mdx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import {
  2. DocBlock,
  3. DocSideBySide,
  4. CodeParams,
  5. Parameter,
  6. Field,
  7. Values,
  8. CodeSnippets,
  9. } from "../../../components/CodeDocBlock";
  10. <DocBlock>
  11. ## getRecentPerformanceSamples
  12. Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and
  13. include the number of transactions and slots that occur in a given time window.
  14. <DocSideBySide>
  15. <CodeParams>
  16. ### Parameters:
  17. <Parameter name="limit" type={"usize"} optional={true}>
  18. number of samples to return (maximum 720)
  19. </Parameter>
  20. ### Result:
  21. An array of `RpcPerfSample<object>` with the following fields:
  22. - `slot: <u64>` - Slot in which sample was taken at
  23. - `numTransactions: <u64>` - Number of transactions processed during the sample period
  24. - `numSlots: <u64>` - Number of slots completed during the sample period
  25. - `samplePeriodSecs: <u16>` - Number of seconds in a sample window
  26. - `numNonVoteTransaction: <u64>` - Number of non-vote transactions processed during the
  27. sample period.
  28. :::info
  29. `numNonVoteTransaction` is present starting with v1.15.
  30. To get a number of voting transactions compute:<br />
  31. `numTransactions - numNonVoteTransaction`
  32. :::
  33. </CodeParams>
  34. <CodeSnippets>
  35. ### Code sample:
  36. ```bash
  37. curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  38. {
  39. "jsonrpc":"2.0", "id":1,
  40. "method": "getRecentPerformanceSamples",
  41. "params": [4]}
  42. '
  43. ```
  44. ### Response:
  45. ```json
  46. {
  47. "jsonrpc": "2.0",
  48. "result": [
  49. {
  50. "numSlots": 126,
  51. "numTransactions": 126,
  52. "numNonVoteTransaction": 1,
  53. "samplePeriodSecs": 60,
  54. "slot": 348125
  55. },
  56. {
  57. "numSlots": 126,
  58. "numTransactions": 126,
  59. "numNonVoteTransaction": 1,
  60. "samplePeriodSecs": 60,
  61. "slot": 347999
  62. },
  63. {
  64. "numSlots": 125,
  65. "numTransactions": 125,
  66. "numNonVoteTransaction": 0,
  67. "samplePeriodSecs": 60,
  68. "slot": 347873
  69. },
  70. {
  71. "numSlots": 125,
  72. "numTransactions": 125,
  73. "numNonVoteTransaction": 0,
  74. "samplePeriodSecs": 60,
  75. "slot": 347748
  76. }
  77. ],
  78. "id": 1
  79. }
  80. ```
  81. </CodeSnippets>
  82. </DocSideBySide>
  83. </DocBlock>