Home
last modified time | relevance | path

Searched hist:13270967 (Results 1 – 2 of 2) sorted by relevance

/openbmc/phosphor-fan-presence/control/json/utils/
H A Dflight_recorder.hpp13270967 Mon Oct 04 14:49:33 CDT 2021 Matt Spinler <spinler@us.ibm.com> control: Create FlightRecorder class

This class provides a flight recorder feature by providing the following
two interfaces:

1. log(const std::string& id, const std::string& message)
2. dump()

log() saves the passed in message in a map with the previous messages
for that ID along with a timestamp when log() was called. It will
discard the oldest message if necessary to keep a maximum of 20.

dump() will write all messages to the file /tmp/fan_control.txt. It
will sort them all based on the timestamp so messages from different IDs
may be interleaved together.

The ID is used in addition to the message with the idea that there could
be one ID per action or per action instance, so that once active part of
fan control that logged a lot wouldn't force out messages from less
active parts.

Example output is:

Oct 01 04:37:19.123923: pcie_card_cooling-0: Setting parameter to 2
Oct 01 04:37:19.129787: mapped_floor-1: Setting new floor to 4755

The first column is the timestamp down to the microsecond, the second
column is the ID, and the third is the message.

Testing on real hardware showed it took about 21 milliseconds for dump()
to run when there were 30 IDs with 20 messages each.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ie3630174c8aa54911e56054e9d7c38bb7dfb3f18
H A Dflight_recorder.cpp13270967 Mon Oct 04 14:49:33 CDT 2021 Matt Spinler <spinler@us.ibm.com> control: Create FlightRecorder class

This class provides a flight recorder feature by providing the following
two interfaces:

1. log(const std::string& id, const std::string& message)
2. dump()

log() saves the passed in message in a map with the previous messages
for that ID along with a timestamp when log() was called. It will
discard the oldest message if necessary to keep a maximum of 20.

dump() will write all messages to the file /tmp/fan_control.txt. It
will sort them all based on the timestamp so messages from different IDs
may be interleaved together.

The ID is used in addition to the message with the idea that there could
be one ID per action or per action instance, so that once active part of
fan control that logged a lot wouldn't force out messages from less
active parts.

Example output is:

Oct 01 04:37:19.123923: pcie_card_cooling-0: Setting parameter to 2
Oct 01 04:37:19.129787: mapped_floor-1: Setting new floor to 4755

The first column is the timestamp down to the microsecond, the second
column is the ID, and the third is the message.

Testing on real hardware showed it took about 21 milliseconds for dump()
to run when there were 30 IDs with 20 messages each.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ie3630174c8aa54911e56054e9d7c38bb7dfb3f18