摘要 |
A method includes monitoring, using a system resource monitor in a system, a plurality of system resource metrics. The system includes a ring buffer with consecutive slots, each slot corresponding to a different location in the memory. The method further includes receiving a system resource metric from the system resource monitor. The method also includes determining a first slot that is flagged as acceptable to be overwritten. If no slot is flagged as acceptable to be overwritten, the method further includes dropping the system resource metric, and the method ends. Otherwise, the method further includes storing the system resource metric in the slot and flagging that the slot is not acceptable to be overwritten. The method further includes detecting that the system resource metric was stored in the first slot, reading the system resource metric from the first slot, and flagging that the first slot is acceptable to be overwritten. |
主权项 |
1. A method, comprising:
monitoring, using a system resource monitor in a system, a plurality of system resource metrics of the system, the system comprising a ring buffer stored in a memory, wherein the ring buffer is comprised of a plurality of consecutive slots, each slot corresponding to a different location in the memory; receiving, by a first thread, one of the plurality of system resource metrics from the system resource monitor; determining, by the first thread, a first slot of the plurality of slots that is flagged as acceptable to be overwritten; if no slot is flagged as acceptable to be overwritten, dropping, by the first thread, the system resource metric; and if the first slot is flagged as acceptable to be overwritten:
storing, by the first thread, the system resource metric in the first slot;flagging, by the first thread, that the first slot is not acceptable to be overwritten;detecting, by a second thread, that the system resource metric was stored in the first slot;reading, by the second thread, the system resource metric from the first slot; andflagging, by the second thread, that the first slot is acceptable to be overwritten. |