README
Overview
The hydro2-network-performance crate provides performance tracking tools for monitoring and measuring the execution of networks in the hydro2 ecosystem. It allows for tracking key statistics such as execution time, number of operators executed, and peak memory usage during the execution of a network.
Key Features
-
Execution Time Tracking
ThePerformanceStatsstruct tracks the time it takes for a network to run, capturing both the start and end time. It also provides the ability to calculate the total duration of network execution. -
Operator Execution Count
The crate keeps track of the number of operators executed during the network's execution. -
Peak Memory Usage
ThePerformanceStatsstruct stores the peak memory usage in bytes, helping monitor the memory footprint during the execution. -
Start and End Timing
The crate provides the ability to mark the start and end of the execution, with methods likestart()andend()for tracking.
PerformanceStats Struct
The PerformanceStats struct is the main entry point for tracking execution statistics. It is designed to start when the network execution begins, and it ends when you call the end() method.
Methods
-
start()
Initializes thePerformanceStatsand records the current time as the start time of the execution. -
end()
Marks the end of the execution and records the current time as the end time. -
total_duration()
Returns the total execution duration as anOption<Duration>. If the execution hasn't ended,Noneis returned.
Usage Example
Below is an example of how to use the PerformanceStats struct to measure network performance:
use PerformanceStats;
use Duration;
In this example, the PerformanceStats::start() method begins tracking, and PerformanceStats::end() ends the tracking once the network execution is complete. The total duration is then printed.
License
Distributed under the OGPv1 License (see ogp-license-text crate for more details).
Repository
Hosted on GitHub:
https://github.com/klebs6/klebs-general