Add a new -A, --stats option

This commit is contained in:
Andrea Mazzoleni 2025-09-29 15:53:43 +02:00
parent c3d34734ae
commit 93804c20c3
5 changed files with 149 additions and 16 deletions

View file

@ -3,7 +3,8 @@ SnapRAID HISTORY
13.0 2025/XX
============
* Add new thermal protection configuration options:
* Add a new -A, --stats option for an extensive view of the process.
* Add new thermal protection configuration options:
- temp_limit TEMPERATURE_CELSIUS
Sets the maximum allowed disk temperature. When any disk exceeds this
limit, SnapRAID stops all operations and spins down the disks to prevent

View file

@ -327,6 +327,7 @@ struct option long_options[] = {
{ "error-limit", 1, 0, 'L' },
{ "import", 1, 0, 'i' },
{ "log", 1, 0, 'l' },
{ "stats", 0, 0, 'A' },
{ "force-zero", 0, 0, 'Z' },
{ "force-empty", 0, 0, 'E' },
{ "force-uuid", 0, 0, 'U' },
@ -441,7 +442,7 @@ struct option long_options[] = {
{ "test-io-cache", 1, 0, OPT_TEST_IO_CACHE },
/* Print IO stats */
{ "test-io-stats", 0, 0, OPT_TEST_IO_STATS },
{ "test-io-stats", 0, 0, OPT_TEST_IO_STATS }, /* now replaced by -A, --stats */
/* Signal condition variable outside the mutex */
{ "test-cond-signal-outside", 0, 0, OPT_TEST_COND_SIGNAL_OUTSIDE },
@ -487,11 +488,11 @@ struct option long_options[] = {
#endif
/*
* Free letters: AgIjJkKMnPQrtuxXWz
* Free letters: gIjJkKMnPQrtuxXWz
*
* The 's' letter is used in main.c
*/
#define OPTIONS "c:f:d:mebp:o:S:B:L:i:l:ZEUDNFRahTC:vqHVGw:"
#define OPTIONS "c:f:d:mebp:o:S:B:L:i:l:AZEUDNFRahTC:vqHVGw:"
volatile int global_interrupt = 0;
@ -766,6 +767,9 @@ int snapraid_main(int argc, char* argv[])
}
log_file = optarg;
break;
case 'A' :
opt.force_stats = 1;
break;
case 'Z' :
opt.force_zero = 1;
break;

View file

@ -53,6 +53,10 @@ snapraid [\-c, \-\-conf CONFIG]
[\-L, \-\-error\-limit NUMBER]
.PD 0
.PP
.PD
[\-A, \-\-stats]
.PD 0
.PP
.PD
[\-v, \-\-verbose] [\-q, \-\-quiet]
.PD 0
@ -1097,6 +1101,37 @@ Applies a global bandwidth limit for all disks. The RATE is
the number of bytes per second. You can specify a multiplier
as K, M, or G (e.g., \-\-bw\-limit 1G).
.TP
.B \-A, \-\-stats
Enables an extended status view that shows additional information.
.PP
.RS 4
The screen displays two graphs:
.RE
.PP
.RS 4
The first graph shows the number of buffered stripes for each
disk, along with the file path of the file currently being
accessed on that disk. Typically, the slowest disk will have
no buffer available, which determines the maximum achievable
bandwidth.
.RE
.PP
.RS 4
The second graph shows the percentage of time spent waiting
over the past 100 seconds. The slowest disk is expected to
cause most of the wait time, while the other disks should have
little or no wait because they can use their buffered stripes.
This graph also shows the time spent waiting for hash
calculations and RAID computations.
.RE
.PP
.RS 4
All computations run in parallel with disk operations.
Therefore, as long as there is measurable wait time for at
least one disk, it indicates that the CPU is fast enough to
keep up with the workload.
.RE
.TP
.B \-Z, \-\-force\-zero
Forces the insecure operation of syncing a file with zero
size that before was not.
@ -1456,10 +1491,25 @@ may interrupt SnapRAID.
.SS temp_limit TEMPERATURE_CELSIUS
Sets the maximum allowed disk temperature in Celsius. When specified,
SnapRAID periodically checks the temperature of all disks using the
smartctl tool. The current disk temperatures are displayed during
processing. If any disk exceeds this limit, all operations stop and
the disks are spun down (put into standby) for the duration defined
by \[dq]temp_sleep\[dq].
smartctl tool. The current disk temperatures are displayed while
SnapRAID is operating. If any disk exceeds this limit, all operations
stop and the disks are spun down (put into standby) for the duration
defined by \[dq]thermal_sleep\[dq].
.PP
During operation, SnapRAID also analyzes the heating curve of each
disk and estimates the long\-term steady temperature they are expected
to reach if activity continues. This predicted steady temperature is
shown in parentheses next to the current value and helps assess
whether the system’s cooling is adequate.
.PP
To perform this analysis, SnapRAID needs a reference for the ambient
system temperature. It first attempts to read it from available
hardware sensors. If no system sensor can be accessed, it uses the
lowest disk temperature measured at the start of the run as a fallback
reference.
.PP
Normally, SnapRAID shows only the temperature of the hottest disk.
To display the temperature of all disks, use the \-A or \-\-stats option.
.SS temp_sleep TIME_IN_MINUTES
Sets the standby time, in minutes, when the temperature limit is
reached. During this period, the disks remain spun down. The default

View file

@ -15,6 +15,7 @@ Synopsis
: [-R, --force-realloc]
: [-S, --start BLKSTART] [-B, --count BLKCOUNT]
: [-L, --error-limit NUMBER]
: [-A, --stats]
: [-v, --verbose] [-q, --quiet]
: status|smart|probe|up|down|diff|sync|scrub|fix|check
: |list|dup|pool|devices|touch|rehash
@ -822,6 +823,29 @@ Options
the number of bytes per second. You can specify a multiplier
as K, M, or G (e.g., --bw-limit 1G).
-A, --stats
Enables an extended status view that shows additional information.
The screen displays two graphs:
The first graph shows the number of buffered stripes for each
disk, along with the file path of the file currently being
accessed on that disk. Typically, the slowest disk will have
no buffer available, which determines the maximum achievable
bandwidth.
The second graph shows the percentage of time spent waiting
over the past 100 seconds. The slowest disk is expected to
cause most of the wait time, while the other disks should have
little or no wait because they can use their buffered stripes.
This graph also shows the time spent waiting for hash
calculations and RAID computations.
All computations run in parallel with disk operations.
Therefore, as long as there is measurable wait time for at
least one disk, it indicates that the CPU is fast enough to
keep up with the workload.
-Z, --force-zero
Forces the insecure operation of syncing a file with zero
size that before was not.
@ -1175,10 +1199,25 @@ Configuration
temp_limit TEMPERATURE_CELSIUS
Sets the maximum allowed disk temperature in Celsius. When specified,
SnapRAID periodically checks the temperature of all disks using the
smartctl tool. The current disk temperatures are displayed during
processing. If any disk exceeds this limit, all operations stop and
the disks are spun down (put into standby) for the duration defined
by "temp_sleep".
smartctl tool. The current disk temperatures are displayed while
SnapRAID is operating. If any disk exceeds this limit, all operations
stop and the disks are spun down (put into standby) for the duration
defined by "thermal_sleep".
During operation, SnapRAID also analyzes the heating curve of each
disk and estimates the long-term steady temperature they are expected
to reach if activity continues. This predicted steady temperature is
shown in parentheses next to the current value and helps assess
whether the system’s cooling is adequate.
To perform this analysis, SnapRAID needs a reference for the ambient
system temperature. It first attempts to read it from available
hardware sensors. If no system sensor can be accessed, it uses the
lowest disk temperature measured at the start of the run as a fallback
reference.
Normally, SnapRAID shows only the temperature of the hottest disk.
To display the temperature of all disks, use the -A or --stats option.
temp_sleep TIME_IN_MINUTES
Sets the standby time, in minutes, when the temperature limit is

View file

@ -19,6 +19,7 @@ snapraid [-c, --conf CONFIG]
[-R, --force-realloc]
[-S, --start BLKSTART] [-B, --count BLKCOUNT]
[-L, --error-limit NUMBER]
[-A, --stats]
[-v, --verbose] [-q, --quiet]
status|smart|probe|up|down|diff|sync|scrub|fix|check
|list|dup|pool|devices|touch|rehash
@ -881,6 +882,29 @@ SnapRAID provides the following options:
the number of bytes per second. You can specify a multiplier
as K, M, or G (e.g., --bw-limit 1G).
-A, --stats
Enables an extended status view that shows additional information.
The screen displays two graphs:
The first graph shows the number of buffered stripes for each
disk, along with the file path of the file currently being
accessed on that disk. Typically, the slowest disk will have
no buffer available, which determines the maximum achievable
bandwidth.
The second graph shows the percentage of time spent waiting
over the past 100 seconds. The slowest disk is expected to
cause most of the wait time, while the other disks should have
little or no wait because they can use their buffered stripes.
This graph also shows the time spent waiting for hash
calculations and RAID computations.
All computations run in parallel with disk operations.
Therefore, as long as there is measurable wait time for at
least one disk, it indicates that the CPU is fast enough to
keep up with the workload.
-Z, --force-zero
Forces the insecure operation of syncing a file with zero
size that before was not.
@ -1259,10 +1283,25 @@ may interrupt SnapRAID.
Sets the maximum allowed disk temperature in Celsius. When specified,
SnapRAID periodically checks the temperature of all disks using the
smartctl tool. The current disk temperatures are displayed during
processing. If any disk exceeds this limit, all operations stop and
the disks are spun down (put into standby) for the duration defined
by "temp_sleep".
smartctl tool. The current disk temperatures are displayed while
SnapRAID is operating. If any disk exceeds this limit, all operations
stop and the disks are spun down (put into standby) for the duration
defined by "thermal_sleep".
During operation, SnapRAID also analyzes the heating curve of each
disk and estimates the long-term steady temperature they are expected
to reach if activity continues. This predicted steady temperature is
shown in parentheses next to the current value and helps assess
whether the system’s cooling is adequate.
To perform this analysis, SnapRAID needs a reference for the ambient
system temperature. It first attempts to read it from available
hardware sensors. If no system sensor can be accessed, it uses the
lowest disk temperature measured at the start of the run as a fallback
reference.
Normally, SnapRAID shows only the temperature of the hottest disk.
To display the temperature of all disks, use the -A or --stats option.
7.12 temp_sleep TIME_IN_MINUTES
-------------------------------