Thursday, November 12, 2020

Bugs to Code Ratio

Bugs to Code Ratio

 

Nice insight.

https://www.mayerdan.com/ruby/2012/11/11/bugs-per-line-of-code-ratio

 

(a) Industry Average: "about 15 - 50 errors per 1000 lines of delivered
code." He further says this is usually representative of code that has some
level of structured programming behind it, but probably includes a mix of
coding techniques.

(b) Microsoft Applications: "about 10 - 20 defects per 1000 lines of code
during in-house testing, and 0.5 defect per KLOC (KLOC IS CALLED AS 1000 lines of code) in released
product (Moore 1992)." He attributes this to a combination of code-reading
techniques and independent testing (discussed further in another chapter of
his book).

(c) "Harlan Mills pioneered 'cleanroom development', a technique that has
been able to achieve rates as low as 3 defects per 1000 lines of code during
in-house testing and 0.1 defect per 1000 lines of code in released product
(Cobb and Mills 1990). A few projects - for example, the space-shuttle
software - have achieved a level of 0 defects in 500,000 lines of code using
a system of format development methods, peer reviews, and statistical
testing."
 
 

Thursday, November 5, 2020

Performance Problem - compilation of file

 

Performance Problem - compilation of file

 

Figure out the time taken for compilation using

$ /usr/bin/time -p gmake abc.o

...

real 18.02
user 9.88
sys 3.16
$

Check where most of the time is spent

Is that on read, write?

$ strace -c -f -o /tmp/strace_cumm.log gmake file.o

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 92.47   17.289082      508502        34         7 wait4
  2.05    0.382373           2    196871           read
  1.94    0.363374           2    166274           write
  1.52    0.284355          12     24364     19274 open
  0.64    0.120390           3     35024     18381 stat
  0.48    0.089184       89184         1           rename
  0.45    0.083519          16      5189         2 close

...

$


Check if is struck somewhere

strace -T -f -o /tmp/strace.log gmake file.o

In parallel, tail -f /tmp/strace.log

 

Check the speed of access  from NFS

$ dd if=file.c of=/dev/null
1946+1 records in
1946+1 records out
996481 bytes (996 kB) copied, 0.0030956 s, 322 MB/s
$
 

Check NFS IO Stats for the filer


$ nfsiostat <mounted_dir>

<NFS-Server:Export directory> mounted on <mounted_directory>:

   op/s         rpc bklog
 298.56    0.00
read:            ops/s             kB/s           kB/op         retrans         avg RTT (ms)    avg exe (ms)
                  0.828  20.987  25.350       0 (0.0%)   33.982  34.012
write:           ops/s             kB/s           kB/op         retrans         avg RTT (ms)    avg exe (ms)
                  0.000   0.000   0.000       0 (0.0%)    0.000   0.000


Check pstack of compiler backend

Is that struck somewhere?