Bug 11023 - smbclient transfer speed shown in kb/s but should be kB/s
smbclient transfer speed shown in kb/s but should be kB/s
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other
All All
: P5 minor
: ---
Assigned To: Jeremy Allison
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2014-12-24 23:37 UTC by dajoker
Modified: 2015-01-09 22:05 UTC (History)
1 user (show)

See Also:

Patch for master (2.39 KB, patch)
2015-01-09 21:54 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description dajoker 2014-12-24 23:37:32 UTC
openSUSE 13.1 x86_64
smbclient 4.1.11

Transferring a file to/from a windows 7 machine using smbclient I noticed the following difference in output:

putting file /home/ab/vm/iso/visio-pro-2013-sp1-x86_64-english-DF3CN-C3MCF-9J7JD-JBT6B-39JRR.iso as \visio-pro-2013-sp1-x86_64-english-DF3CN-C3MCF-9J7JD-JBT6B-39JRR.iso (11410.5 kb/s) (average 11410.5 kb/s)
smb: \>  ls
  visio-pro-2013-sp1-x86_64-english-DF3CN-C3MCF-9J7JD-JBT6B-39JRR.iso      A 566071296  Wed Dec 24 15:36:06 2014

smb: \> get visio-pro-2013-sp1-x86_64-english-DF3CN-C3MCF-9J7JD-JBT6B-39JRR.iso /dev/shm/visiotmp.iso
getting file \visio-pro-2013-sp1-x86_64-english-DF3CN-C3MCF-9J7JD-JBT6B-39JRR.iso of size 566071296 as /dev/shm/visiotmp.iso (11472.3 KiloBytes/sec) (average 11472.3 KiloBytes/sec)

The first transfer, putting the file to windows, showed the speed as '11410.5 kb/s even though it transfered 566,071,296 bytes in forty-eight seconds or so, clearly transferring closer to 11,410 kB/s (bytes, vs. bits).  The return trip pulling the same file back showed the speed in KiloBytes/sec and took almost the exact same time, confirming that the metric is the same as the numbers are very similar.

Reproducible: Always

Expected Results: Indicate transfer speed with correct units, either kB or KiB, to better indicate true transfer speed.

Actual Results: Transfer speed represented in kb/s, implying the speed is actually 1/8 what it really was.

I pulled down the git repo and found the following files with the strings that, I presume, all need to be modified.

source3/client/client.c:   DEBUG(1,("(%3.1f kb/s) (average %3.1f kb/s)\n",
source3/torture/torture.c: printf("Wrote %d kbytes in %.2f seconds: %d kb/sec\n", (int)kbytes,
source4/client/client.c:   DEBUG(2,("(%3.1f kb/s) (average %3.1f kb/s)\n",
source4/client/client.c:   DEBUG(1,("(%3.1f kb/s) (average %3.1f kb/s)\n",
Comment 1 Jeremy Allison 2015-01-09 21:54:09 UTC
Created attachment 10608 [details]
Patch for master

Let me know if this works for you and I'll submit to master.
Comment 2 dajoker 2015-01-09 22:05:10 UTC
Not sure if you're asking me, but I think it looks like almost exactly what I would do.  Because I'm pedantic by nature, and since this appaers to be calculating groups of 1024 (vs. 1000) bytes, I'd probably rewrite that to be KiB:


Either way it's much better, so do whatever you think is best.

Summary of units:
kb = 1000 bits = 125 bytes
kB = 1000 bytes
KiB = 1024 bytes  #the unit actually reprsented by code's output if I'm reading correctly, though I am admittedly not a C-expert.