|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D.gnu - Code Coverage with GDC (gcov)AFAIK, this should be similar to DMD's new -cov flag: (http://www.digitalmars.com/d/code_coverage.html) # gdc -o sieve -fprofile-arcs -ftest-coverage sieve.d # ./sieve 10 iterations 1899 primes # gcov sieve.d 100.00% of 15 lines executed in file sieve.d Creating sieve.d.gcov. The contents of "sieve.d.gcov" is similar to "sieve.lst", though it is using different separators and number display: -: 0:Source:sieve.d -: 0:Object:sieve.bb -: 1:/* Sieve of Eratosthenes prime numbers */ -: 2:bit[8191] flags; -: 3: 2: 4:void main() -: 5:{ 1: 6: int i, count, prime, k; 1: 7: printf("10 iterations\n"); 1: 8: for (int iter = 1; iter <= 10; iter++) -: 9: { 10: 10: count = 0; 10: 11: flags[] = 1; 10: 12: for (i = 0; i < flags.length; i++) -: 13: { 81910: 14: if (flags[i]) -: 15: { 18990: 16: prime = i + i + 3; 18990: 17: k = i + prime; 168980: 18: while (k < flags.length) -: 19: { 149990: 20: flags[k] = 0; 149990: 21: k += prime; -: 22: } 18990: 23: count += 1; -: 24: } -: 25: } -: 26: } 1: 27: printf ("\n%d primes\n", count); -: 28:} It seems to start the count of loops (etc) diffently, but I'm not sure what significance that will have... HTH, --anders Dec 07 2005
Anders F Björklund wrote:AFAIK, this should be similar to DMD's new -cov flag: (http://www.digitalmars.com/d/code_coverage.html) # gdc -o sieve -fprofile-arcs -ftest-coverage sieve.d # ./sieve 10 iterations 1899 primes # gcov sieve.d 100.00% of 15 lines executed in file sieve.d Creating sieve.d.gcov. The contents of "sieve.d.gcov" is similar to "sieve.lst", though it is using different separators and number display: Dec 07 2005
|