mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Use GB instead of GiB to be more consistent with HD size.
This commit is contained in:
parent
dd888c30db
commit
3a4ce0b1e2
7 changed files with 24 additions and 17 deletions
2
HISTORY
2
HISTORY
|
|
@ -29,6 +29,8 @@ SnapRAID HISTORY
|
|||
* In the "status" command the "Wasted" column now shows a negative
|
||||
number for the amount of space that you can still waste without
|
||||
filling up the parity.
|
||||
* In the "status" and others commands we now use GB instead of GiB,
|
||||
when referring to disk space.
|
||||
* Renames the -s and -t options to -S and -B as they are intended to
|
||||
be manual only operations.
|
||||
* Windows binary built with gcc 4.8.1 using the MXE cross compiler 2.23,
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ void state_dup(struct snapraid_state* state)
|
|||
tommy_hashdyn_done(&hashset);
|
||||
|
||||
msg_status("\n");
|
||||
msg_status("%8u duplicates, for %" PRIu64 " MiB\n", count, size / (1024 * 1024));
|
||||
msg_status("%8u duplicates, for %" PRIu64 " GB\n", count, size / GIGA);
|
||||
if (count)
|
||||
msg_status("There are duplicates!\n");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void state_list(struct snapraid_state* state)
|
|||
}
|
||||
|
||||
msg_status("\n");
|
||||
msg_status("%8u files, for %" PRIu64 " GiB\n", file_count, file_size / (1024 * 1024 * 1024));
|
||||
msg_status("%8u files, for %" PRIu64 " GB\n", file_count, file_size / GIGA);
|
||||
msg_status("%8u links\n", link_count);
|
||||
|
||||
msg_tag("summary:file_count:%u\n", file_count);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void memory(void)
|
|||
/* size of the file + the size of the 3 hashtables pointers to it, * 2 for the hashtable grow factor */
|
||||
msg_tag("memory:file:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_file) + 3*2*sizeof(void*)));
|
||||
|
||||
msg_progress("Using %u MiB of memory.\n", (unsigned)(malloc_counter() / 1024 / 1024));
|
||||
msg_progress("Using %u MiB of memory.\n", (unsigned)(malloc_counter() / (1024 * 1024)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4622,13 +4622,13 @@ void state_progress_end(struct snapraid_state* state, block_off_t countpos, bloc
|
|||
time_t now;
|
||||
time_t elapsed;
|
||||
|
||||
unsigned countsize_MiB = (countsize + 1024 * 1024 - 1) / (1024 * 1024);
|
||||
unsigned countsize_MB = (countsize + MEGA - 1) / MEGA;
|
||||
|
||||
now = time(0);
|
||||
|
||||
elapsed = now - state->progress_whole_start - state->progress_wasted;
|
||||
|
||||
msg_bar("%u%% completed, %u MiB processed", countpos * 100 / countmax, countsize_MiB);
|
||||
msg_bar("%u%% completed, %u MB processed", countpos * 100 / countmax, countsize_MB);
|
||||
if (elapsed >= 60)
|
||||
msg_bar(" in %u:%02u", (unsigned)(elapsed / 3600), (unsigned)((elapsed % 3600) / 60));
|
||||
msg_bar("\n");
|
||||
|
|
@ -4738,7 +4738,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
|
||||
/* estimate the speed in MiB/s */
|
||||
if (delta_time != 0)
|
||||
out_speed = (unsigned)(delta_size / (1024 * 1024) / delta_time);
|
||||
out_speed = (unsigned)(delta_size / MEGA / delta_time);
|
||||
|
||||
/* estimate the cpu usage percentage */
|
||||
if (delta_tick_total != 0)
|
||||
|
|
@ -4753,7 +4753,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
msg_tag("run:pos:%u:%u:%" PRIu64 ":%u:%u:%u:%u:%" PRIu64 "\n", blockpos, countpos, countsize, out_perc, out_eta, out_speed, out_cpu, (uint64_t)elapsed);
|
||||
msg_flush();
|
||||
} else {
|
||||
msg_bar("%u%%, %u MiB", out_perc, (unsigned)(countsize / (1024 * 1024)));
|
||||
msg_bar("%u%%, %u MiB", out_perc, (unsigned)(countsize / MEGA));
|
||||
if (out_speed)
|
||||
msg_bar(", %u MiB/s", out_speed);
|
||||
if (out_cpu)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ const char* lev_config_name(unsigned level);
|
|||
/****************************************************************************/
|
||||
/* state */
|
||||
|
||||
/**
|
||||
* Units for disk space.
|
||||
*/
|
||||
#define MEGA (1000 * 1000)
|
||||
#define GIGA (1000 * 1000 * 1000)
|
||||
|
||||
/**
|
||||
* File modes.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ int state_status(struct snapraid_state* state)
|
|||
uint64_t file_size;
|
||||
uint64_t file_block_count;
|
||||
uint64_t file_block_free;
|
||||
uint64_t base = 1024 * 1024 * 1024ULL;
|
||||
block_off_t parity_block_free;
|
||||
unsigned unsynced_blocks;
|
||||
uint64_t all_wasted;
|
||||
|
|
@ -100,7 +99,7 @@ int state_status(struct snapraid_state* state)
|
|||
printf("SnapRAID status report:\n");
|
||||
printf("\n");
|
||||
printf(" Files Fragmented Excess Wasted Used Free Use Name\n");
|
||||
printf(" Files Fragments GiB GiB GiB \n");
|
||||
printf(" Files Fragments GB GB GB\n");
|
||||
|
||||
/* count fragments */
|
||||
file_count = 0;
|
||||
|
|
@ -200,17 +199,17 @@ int state_status(struct snapraid_state* state)
|
|||
printf("%8u", disk_file_count);
|
||||
printf("%8u", disk_file_fragmented);
|
||||
printf("%8u", disk_extra_fragment);
|
||||
if (wasted < -100LL * 1024 * 1024 * 1024) {
|
||||
if (wasted < -100LL * GIGA) {
|
||||
printf(" -");
|
||||
} else if (wasted < 0) {
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "-%" PRId64 ".%01" PRIu64, -wasted / base, (-wasted * 10 / base) % 10);
|
||||
snprintf(buffer, sizeof(buffer), "-%" PRId64 ".%01" PRIu64, -wasted / GIGA, (-wasted * 10 / GIGA) % 10);
|
||||
printf("%8s", buffer);
|
||||
} else {
|
||||
printf("%6" PRIu64 ".%01" PRIu64, wasted / base, (wasted * 10 / base) % 10);
|
||||
printf("%6" PRIu64 ".%01" PRIu64, wasted / GIGA, (wasted * 10 / GIGA) % 10);
|
||||
}
|
||||
printf("%8" PRIu64, disk_file_size / base);
|
||||
printf("%8" PRIu64, (disk_block_max - disk_block_count) * (uint64_t)state->block_size / base);
|
||||
printf("%8" PRIu64, disk_file_size / GIGA);
|
||||
printf("%8" PRIu64, (disk_block_max - disk_block_count) * (uint64_t)state->block_size / GIGA);
|
||||
printf(" %3u%%", perc(disk_block_count, disk_block_max));
|
||||
printf(" %s\n", disk->name);
|
||||
|
||||
|
|
@ -233,9 +232,9 @@ int state_status(struct snapraid_state* state)
|
|||
printf("%8u", file_count);
|
||||
printf("%8u", file_fragmented);
|
||||
printf("%8u", extra_fragment);
|
||||
printf("%6" PRIu64 ".%01" PRIu64, all_wasted / base, (all_wasted * 10 / base) % 10);
|
||||
printf("%8" PRIu64, file_size / base);
|
||||
printf("%8" PRIu64, file_block_free * state->block_size / base);
|
||||
printf("%6" PRIu64 ".%01" PRIu64, all_wasted / GIGA, (all_wasted * 10 / GIGA) % 10);
|
||||
printf("%8" PRIu64, file_size / GIGA);
|
||||
printf("%8" PRIu64, file_block_free * state->block_size / GIGA);
|
||||
printf(" %3u%%", perc(file_block_count, file_block_count + file_block_free));
|
||||
printf("\n");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue