mirror of
https://github.com/rclone/rclone
synced 2024-12-21 11:45:56 +01:00
Change byte unit format from MiByte to MiB
This commit is contained in:
parent
8500d95579
commit
f1f923a986
@ -66,7 +66,7 @@ const (
|
||||
//
|
||||
// Speed vs chunk size uploading a 1 GiB file on 2017-11-22
|
||||
//
|
||||
// Chunk Size MiB, Speed MiByte/s, % of max
|
||||
// Chunk Size MiB, Speed MiB/s, % of max
|
||||
// 1 1.364 11%
|
||||
// 2 2.443 19%
|
||||
// 4 4.288 33%
|
||||
|
@ -51,11 +51,11 @@ output. The output is typically used, free, quota and trash contents.
|
||||
|
||||
E.g. Typical output from ` + "`rclone about remote:`" + ` is:
|
||||
|
||||
Total: 17 GiByte
|
||||
Used: 7.444 GiByte
|
||||
Free: 1.315 GiByte
|
||||
Trashed: 100.000 MiByte
|
||||
Other: 8.241 GiByte
|
||||
Total: 17 GiB
|
||||
Used: 7.444 GiB
|
||||
Free: 1.315 GiB
|
||||
Trashed: 100.000 MiB
|
||||
Other: 8.241 GiB
|
||||
|
||||
Where the fields are:
|
||||
|
||||
|
@ -427,9 +427,9 @@ possibly signed sequence of decimal numbers, each with optional
|
||||
fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid
|
||||
time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
|
||||
|
||||
Options which use SIZE use KiByte (multiples of 1024 bytes) by default.
|
||||
However, a suffix of `B` for Byte, `K` for KiByte, `M` for MiByte,
|
||||
`G` for GiByte, `T` for TiByte and `P` for PiByte may be used. These are
|
||||
Options which use SIZE use KiB (multiples of 1024 bytes) by default.
|
||||
However, a suffix of `B` for Byte, `K` for KiB, `M` for MiB,
|
||||
`G` for GiB, `T` for TiB and `P` for PiB may be used. These are
|
||||
the binary units, e.g. 1, 2\*\*10, 2\*\*20, 2\*\*30 respectively.
|
||||
|
||||
### --backup-dir=DIR ###
|
||||
@ -473,9 +473,9 @@ This option controls the bandwidth limit. For example
|
||||
|
||||
--bwlimit 10M
|
||||
|
||||
would mean limit the upload and download bandwidth to 10 MiByte/s.
|
||||
would mean limit the upload and download bandwidth to 10 MiB/s.
|
||||
**NB** this is **bytes** per second not **bits** per second. To use a
|
||||
single limit, specify the desired bandwidth in KiByte/s, or use a
|
||||
single limit, specify the desired bandwidth in KiB/s, or use a
|
||||
suffix B|K|M|G|T|P. The default is `0` which means to not limit bandwidth.
|
||||
|
||||
The upload and download bandwidth can be specified seperately, as
|
||||
@ -483,13 +483,13 @@ The upload and download bandwidth can be specified seperately, as
|
||||
|
||||
--bwlimit 10M:100k
|
||||
|
||||
would mean limit the upload bandwidth to 10 MiByte/s and the download
|
||||
bandwidth to 100 KiByte/s. Either limit can be "off" meaning no limit, so
|
||||
would mean limit the upload bandwidth to 10 MiB/s and the download
|
||||
bandwidth to 100 KiB/s. Either limit can be "off" meaning no limit, so
|
||||
to just limit the upload bandwidth you would use
|
||||
|
||||
--bwlimit 10M:off
|
||||
|
||||
this would limit the upload bandwidth to 10 MiByte/s but the download
|
||||
this would limit the upload bandwidth to 10 MiB/s but the download
|
||||
bandwidth would be unlimited.
|
||||
|
||||
When specified as above the bandwidth limits last for the duration of
|
||||
@ -511,19 +511,19 @@ working hours could be:
|
||||
|
||||
`--bwlimit "08:00,512k 12:00,10M 13:00,512k 18:00,30M 23:00,off"`
|
||||
|
||||
In this example, the transfer bandwidth will be set to 512 KiByte/s
|
||||
at 8am every day. At noon, it will rise to 10 MiByte/s, and drop back
|
||||
to 512 KiByte/sec at 1pm. At 6pm, the bandwidth limit will be set to
|
||||
30 MiByte/s, and at 11pm it will be completely disabled (full speed).
|
||||
In this example, the transfer bandwidth will be set to 512 KiB/s
|
||||
at 8am every day. At noon, it will rise to 10 MiB/s, and drop back
|
||||
to 512 KiB/sec at 1pm. At 6pm, the bandwidth limit will be set to
|
||||
30 MiB/s, and at 11pm it will be completely disabled (full speed).
|
||||
Anything between 11pm and 8am will remain unlimited.
|
||||
|
||||
An example of timetable with `WEEKDAY` could be:
|
||||
|
||||
`--bwlimit "Mon-00:00,512 Fri-23:59,10M Sat-10:00,1M Sun-20:00,off"`
|
||||
|
||||
It means that, the transfer bandwidth will be set to 512 KiByte/s on
|
||||
Monday. It will rise to 10 MiByte/s before the end of Friday. At 10:00
|
||||
on Saturday it will be set to 1 MiByte/s. From 20:00 on Sunday it will
|
||||
It means that, the transfer bandwidth will be set to 512 KiB/s on
|
||||
Monday. It will rise to 10 MiB/s before the end of Friday. At 10:00
|
||||
on Saturday it will be set to 1 MiB/s. From 20:00 on Sunday it will
|
||||
be unlimited.
|
||||
|
||||
Timeslots without `WEEKDAY` are extended to the whole week. So this
|
||||
@ -542,7 +542,7 @@ being the non HTTP backends, `ftp`, `sftp` and `tardigrade`).
|
||||
Note that the units are **Byte/s**, not **bit/s**. Typically
|
||||
connections are measured in bit/s - to convert divide by 8. For
|
||||
example, let's say you have a 10 Mbit/s connection and you wish rclone
|
||||
to use half of it - 5 Mbit/s. This is 5/8 = 0.625 MiByte/s so you would
|
||||
to use half of it - 5 Mbit/s. This is 5/8 = 0.625 MiB/s so you would
|
||||
use a `--bwlimit 0.625M` parameter for rclone.
|
||||
|
||||
On Unix systems (Linux, macOS, …) the bandwidth limiter can be toggled by
|
||||
@ -563,7 +563,7 @@ change the bwlimit dynamically:
|
||||
This option controls per file bandwidth limit. For the options see the
|
||||
`--bwlimit` flag.
|
||||
|
||||
For example use this to allow no transfers to be faster than 1 MiByte/s
|
||||
For example use this to allow no transfers to be faster than 1 MiB/s
|
||||
|
||||
--bwlimit-file 1M
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ Use the -i flag to see what would be copied before copying.
|
||||
|
||||
Drive has quite a lot of rate limiting. This causes rclone to be
|
||||
limited to transferring about 2 files per second only. Individual
|
||||
files may be transferred much faster at 100s of MiByte/s but lots of
|
||||
files may be transferred much faster at 100s of MiB/s but lots of
|
||||
small files can take a long time.
|
||||
|
||||
Server side copies are also subject to a separate rate limit. If you
|
||||
|
@ -586,17 +586,17 @@ remote or flag value. The fix then is to quote values containing spaces.
|
||||
### `--min-size` - Don't transfer any file smaller than this
|
||||
|
||||
Controls the minimum size file within the scope of an rclone command.
|
||||
Default units are `KiByte` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.
|
||||
Default units are `KiB` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.
|
||||
|
||||
E.g. `rclone ls remote: --min-size 50k` lists files on `remote:` of 50 KiByte
|
||||
E.g. `rclone ls remote: --min-size 50k` lists files on `remote:` of 50 KiB
|
||||
size or larger.
|
||||
|
||||
### `--max-size` - Don't transfer any file larger than this
|
||||
|
||||
Controls the maximum size file within the scope of an rclone command.
|
||||
Default units are `KiByte` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.
|
||||
Default units are `KiB` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.
|
||||
|
||||
E.g. `rclone ls remote: --max-size 1G` lists files on `remote:` of 1 GiByte
|
||||
E.g. `rclone ls remote: --max-size 1G` lists files on `remote:` of 1 GiB
|
||||
size or smaller.
|
||||
|
||||
### `--max-age` - Don't transfer any file older than this
|
||||
@ -650,7 +650,7 @@ E.g. the scope of `rclone sync -i A: B:` can be restricted:
|
||||
|
||||
rclone --min-size 50k --delete-excluded sync A: B:
|
||||
|
||||
All files on `B:` which are less than 50 KiByte are deleted
|
||||
All files on `B:` which are less than 50 KiB are deleted
|
||||
because they are excluded from the rclone sync command.
|
||||
|
||||
### `--dump filters` - dump the filters to the output
|
||||
|
@ -18,8 +18,8 @@ These flags are available for every command.
|
||||
--backup-dir string Make backups into hierarchy based in DIR.
|
||||
--bind string Local address to bind to for outgoing connections, IPv4, IPv6 or name.
|
||||
--buffer-size SizeSuffix In memory buffer size when reading files for each --transfer. (default 16Mi)
|
||||
--bwlimit BwTimetable Bandwidth limit in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.
|
||||
--bwlimit-file BwTimetable Bandwidth limit per file in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.
|
||||
--bwlimit BwTimetable Bandwidth limit in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.
|
||||
--bwlimit-file BwTimetable Bandwidth limit per file in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.
|
||||
--ca-cert string CA certificate used to verify servers
|
||||
--cache-dir string Directory rclone will use for caching. (default "$HOME/.cache/rclone")
|
||||
--check-first Do all the checks before starting transfers.
|
||||
|
@ -390,9 +390,9 @@ func (s *StatsInfo) String() string {
|
||||
}
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintf(buf, "%s%11s / %s, %s, %s, ETA %s%s",
|
||||
_, _ = fmt.Fprintf(buf, "%s%13s / %s, %s, %s, ETA %s%s",
|
||||
dateString,
|
||||
fs.SizeSuffix(s.bytes),
|
||||
fs.SizeSuffix(s.bytes).ByteUnit(),
|
||||
fs.SizeSuffix(ts.totalBytes).ByteUnit(),
|
||||
percent(s.bytes, ts.totalBytes),
|
||||
displaySpeedString,
|
||||
|
@ -59,7 +59,7 @@ const defaultMaxBurstSize = 4 * 1024 * 1024 // must be bigger than the biggest r
|
||||
func newEmptyTokenBucket(bandwidth fs.SizeSuffix) *rate.Limiter {
|
||||
// Relate maxBurstSize to bandwidth limit
|
||||
// 4M gives 2.5 Gb/s on Windows
|
||||
// Use defaultMaxBurstSize up to 2GBit/s (256MByte/s) then scale
|
||||
// Use defaultMaxBurstSize up to 2GBit/s (256MiB/s) then scale
|
||||
maxBurstSize := (bandwidth * defaultMaxBurstSize) / (256 * 1024 * 1024)
|
||||
if maxBurstSize < defaultMaxBurstSize {
|
||||
maxBurstSize = defaultMaxBurstSize
|
||||
@ -104,7 +104,7 @@ func (tb *tokenBucket) StartTokenBucket(ctx context.Context) {
|
||||
tb.currLimit = ci.BwLimit.LimitAt(time.Now())
|
||||
if tb.currLimit.Bandwidth.IsSet() {
|
||||
tb.curr = newTokenBucket(tb.currLimit.Bandwidth)
|
||||
fs.Infof(nil, "Starting bandwidth limiter at %vByte/s", &tb.currLimit.Bandwidth)
|
||||
fs.Infof(nil, "Starting bandwidth limiter at %v Byte/s", &tb.currLimit.Bandwidth)
|
||||
|
||||
// Start the SIGUSR2 signal handler to toggle bandwidth.
|
||||
// This function does nothing in windows systems.
|
||||
|
@ -97,8 +97,8 @@ func AddFlags(ci *fs.ConfigInfo, flagSet *pflag.FlagSet) {
|
||||
flags.IntVarP(flagSet, &ci.StatsFileNameLength, "stats-file-name-length", "", ci.StatsFileNameLength, "Max file name length in stats. 0 for no limit")
|
||||
flags.FVarP(flagSet, &ci.LogLevel, "log-level", "", "Log level DEBUG|INFO|NOTICE|ERROR")
|
||||
flags.FVarP(flagSet, &ci.StatsLogLevel, "stats-log-level", "", "Log level to show --stats output DEBUG|INFO|NOTICE|ERROR")
|
||||
flags.FVarP(flagSet, &ci.BwLimit, "bwlimit", "", "Bandwidth limit in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.")
|
||||
flags.FVarP(flagSet, &ci.BwLimitFile, "bwlimit-file", "", "Bandwidth limit per file in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.")
|
||||
flags.FVarP(flagSet, &ci.BwLimit, "bwlimit", "", "Bandwidth limit in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.")
|
||||
flags.FVarP(flagSet, &ci.BwLimitFile, "bwlimit-file", "", "Bandwidth limit per file in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.")
|
||||
flags.FVarP(flagSet, &ci.BufferSize, "buffer-size", "", "In memory buffer size when reading files for each --transfer.")
|
||||
flags.FVarP(flagSet, &ci.StreamingUploadCutoff, "streaming-upload-cutoff", "", "Cutoff for switching to chunked upload if file size is unknown. Upload starts after reaching cutoff or when file ends.")
|
||||
flags.FVarP(flagSet, &ci.Dump, "dump", "", "List of items to dump from: "+fs.DumpFlagsList)
|
||||
|
@ -104,21 +104,11 @@ func (x SizeSuffix) BitRateUnit() string {
|
||||
|
||||
// ByteUnit turns SizeSuffix into a string with byte unit
|
||||
func (x SizeSuffix) ByteUnit() string {
|
||||
return x.unit("Byte")
|
||||
return x.unit("B")
|
||||
}
|
||||
|
||||
// ByteRateUnit turns SizeSuffix into a string with byte rate unit
|
||||
func (x SizeSuffix) ByteRateUnit() string {
|
||||
return x.unit("Byte/s")
|
||||
}
|
||||
|
||||
// ByteShortUnit turns SizeSuffix into a string with byte unit short form
|
||||
func (x SizeSuffix) ByteShortUnit() string {
|
||||
return x.unit("B")
|
||||
}
|
||||
|
||||
// ByteRateShortUnit turns SizeSuffix into a string with byte rate unit short form
|
||||
func (x SizeSuffix) ByteRateShortUnit() string {
|
||||
return x.unit("B/s")
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ func TestSizeSuffixString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSizeSuffixByteShortUnit(t *testing.T) {
|
||||
func TestSizeSuffixByteUnit(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in float64
|
||||
want string
|
||||
@ -58,30 +58,6 @@ func TestSizeSuffixByteShortUnit(t *testing.T) {
|
||||
{1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiB"},
|
||||
{-1, "off"},
|
||||
{-100, "off"},
|
||||
} {
|
||||
ss := SizeSuffix(test.in)
|
||||
got := ss.ByteShortUnit()
|
||||
assert.Equal(t, test.want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSizeSuffixByteUnit(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in float64
|
||||
want string
|
||||
}{
|
||||
{0, "0 Byte"},
|
||||
{102, "102 Byte"},
|
||||
{1024, "1 KiByte"},
|
||||
{1024 * 1024, "1 MiByte"},
|
||||
{1024 * 1024 * 1024, "1 GiByte"},
|
||||
{10 * 1024 * 1024 * 1024, "10 GiByte"},
|
||||
{10.1 * 1024 * 1024 * 1024, "10.100 GiByte"},
|
||||
{10 * 1024 * 1024 * 1024 * 1024, "10 TiByte"},
|
||||
{10 * 1024 * 1024 * 1024 * 1024 * 1024, "10 PiByte"},
|
||||
{1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiByte"},
|
||||
{-1, "off"},
|
||||
{-100, "off"},
|
||||
} {
|
||||
ss := SizeSuffix(test.in)
|
||||
got := ss.ByteUnit()
|
||||
|
Loading…
Reference in New Issue
Block a user