Difference between revisions of "Development tools"

From D Wiki
Jump to: navigation, search
(Add dman)
(CPU profiling)
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
== Compilers ==
 +
 +
See [[Compilers]].
 +
 +
== Package Manager ==
 +
 +
* [http://code.dlang.org/ DUB] - Also functions as a build tool
 +
 
== Building ==
 
== Building ==
  
Line 33: Line 41:
 
* [http://dlang.org/expression.html#AssertExpression Asserts], [http://dlang.org/contracts.html#Invariants invariants], and [http://dlang.org/contracts.html contract programming] (enabled by default, disabled by the <tt>-release</tt> compiler switch)
 
* [http://dlang.org/expression.html#AssertExpression Asserts], [http://dlang.org/contracts.html#Invariants invariants], and [http://dlang.org/contracts.html contract programming] (enabled by default, disabled by the <tt>-release</tt> compiler switch)
 
* [http://dlang.org/arrays.html#bounds Array bounds checking] (enabled by default, disabled by the <tt>-release</tt> or <tt>-boundscheck=off</tt> compiler switches)
 
* [http://dlang.org/arrays.html#bounds Array bounds checking] (enabled by default, disabled by the <tt>-release</tt> or <tt>-boundscheck=off</tt> compiler switches)
* [http://dlang.org/unittest.html Unit tests] (enabled by the <tt>-unittest</tt> compiler switch.
+
* [http://dlang.org/unittest.html Unit tests] (enabled by the <tt>-unittest</tt> compiler switch).
  
 
==== Coverage analysis ====
 
==== Coverage analysis ====
Line 54: Line 62:
 
The D compiler can instrument generated code to measure per-function profiling information, and save a report on program exit.
 
The D compiler can instrument generated code to measure per-function profiling information, and save a report on program exit.
 
This is enabled by the <tt>-profile</tt> compiler switch.
 
This is enabled by the <tt>-profile</tt> compiler switch.
 +
 +
The trace.log file can also be converted into a graphical HTML page using the third party [https://bitbucket.org/andrewtrotman/d-profile-viewer D Profile Viewer].
  
 
==== Heap profiling ====
 
==== Heap profiling ====
Line 59: Line 69:
 
Starting with DMD 2.068, the D compiler can instrument memory allocations, and save a report on program exit.
 
Starting with DMD 2.068, the D compiler can instrument memory allocations, and save a report on program exit.
 
This is enabled by the <tt>-profile=gc</tt> compiler switch.
 
This is enabled by the <tt>-profile=gc</tt> compiler switch.
 +
 +
This is also available through the command line switch "--DRT-gcopt=profile:1" see:
 +
http://dlang.org/changelog.html#gc-options
  
 
=== Third party ===
 
=== Third party ===
Line 67: Line 80:
  
 
* [https://github.com/VerySleepy/verysleepy Very Sleepy] is a polling CPU profiler for Windows which works well with D. Debug information must be in PDB format (can be done by compiling with <tt>-m64</tt>, <tt>-m32mscoff</tt>, or by converting it using [https://github.com/rainers/cv2pdb cv2pdb]).
 
* [https://github.com/VerySleepy/verysleepy Very Sleepy] is a polling CPU profiler for Windows which works well with D. Debug information must be in PDB format (can be done by compiling with <tt>-m64</tt>, <tt>-m32mscoff</tt>, or by converting it using [https://github.com/rainers/cv2pdb cv2pdb]).
 +
 +
* [https://software.intel.com/en-us/articles/intel-architecture-code-analyzer IACA] profiles port usage. Works on asm level therefore it also works with d markers are inserted with (asm pure { mov EBX, 111 ; db 0x64, 0x67, 0x90 ; } and (asm pure { mov EBX, 222 ; db 0x64, 0x67, 0x90 ; })
  
 
==== File size profiling ====
 
==== File size profiling ====
Line 72: Line 87:
 
* [http://thecybershadow.net/d/mapview/ D map treemap viewer] can visualize a .map file in a treemap, and allows seeing at a glance what is using the most space in a compiled executable. Generating map files can be enabled with the <tt>-map</tt> compiler switch.
 
* [http://thecybershadow.net/d/mapview/ D map treemap viewer] can visualize a .map file in a treemap, and allows seeing at a glance what is using the most space in a compiled executable. Generating map files can be enabled with the <tt>-map</tt> compiler switch.
 
* On the same page is a tool which attempts to disassemble an ELF binary, and finds which symbol is pulling in which symbol.
 
* On the same page is a tool which attempts to disassemble an ELF binary, and finds which symbol is pulling in which symbol.
 +
 +
==== Build time profiling ====
 +
 +
* [https://github.com/CyberShadow/DBuildStat DBuildStat] can measure the parsing and compilation times of a large project on a module-by-module basis ([http://dump.thecybershadow.net/e9aacf7a44a5a6a9c7b297f065eaed11/app.svg example output]).
 +
* [https://github.com/CyberShadow/ProcMonTools pmxml2svg] can graph a [http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx Process Monitor] .pmxml file ([http://dump.thecybershadow.net/cce8b705beecd97213c67923c2a67a48/dfeed.svg example output]).
  
 
== Integration ==
 
== Integration ==

Revision as of 03:44, 26 June 2016

Compilers

See Compilers.

Package Manager

  • DUB - Also functions as a build tool

Building

See Build Tools.

Documentation

Built-in

  • The D programming language has a built-in code documentation language (DDoc) and documentation generation, enabled by the -D compiler switch.
  • The dman tool can be used to quickly look up D keywords or standard library symbols.

Third-party

See the documentation generators section in Community:Open_Source_Projects.

Source code

  • dfmt - formats D code
  • dfix - automatically updates D code

See also: Binding generators

Debugging

Built-in

Language features

The D programming language has built-in support for a number of debugging features:

Coverage analysis

The D compiler can generate code coverage reports, enabled by the -cov compiler switch. See the Code Coverage page for more information.

Third-party

See the Debuggers page for a list of third-party debuggers.

See also: Troubleshooting Tools

Profiling

Built-in

CPU profiling

The D compiler can instrument generated code to measure per-function profiling information, and save a report on program exit. This is enabled by the -profile compiler switch.

The trace.log file can also be converted into a graphical HTML page using the third party D Profile Viewer.

Heap profiling

Starting with DMD 2.068, the D compiler can instrument memory allocations, and save a report on program exit. This is enabled by the -profile=gc compiler switch.

This is also available through the command line switch "--DRT-gcopt=profile:1" see: http://dlang.org/changelog.html#gc-options

Third party

CPU profiling

  • Callgrind (from Valgrind) works well with D. D symbols will need be demangled (see #Demangling below).
  • Very Sleepy is a polling CPU profiler for Windows which works well with D. Debug information must be in PDB format (can be done by compiling with -m64, -m32mscoff, or by converting it using cv2pdb).
  • IACA profiles port usage. Works on asm level therefore it also works with d markers are inserted with (asm pure { mov EBX, 111 ; db 0x64, 0x67, 0x90 ; } and (asm pure { mov EBX, 222 ; db 0x64, 0x67, 0x90 ; })

File size profiling

  • D map treemap viewer can visualize a .map file in a treemap, and allows seeing at a glance what is using the most space in a compiled executable. Generating map files can be enabled with the -map compiler switch.
  • On the same page is a tool which attempts to disassemble an ELF binary, and finds which symbol is pulling in which symbol.

Build time profiling

Integration

Demangling

To demangle D symbols emitted by third-party programs, pipe the output through the ddemangle tool. The tool will recognize D symbols in its input, and replace them with the demangled versions, while outputting all other input intact.

D language development

These tools may be helpful when submitting D bugs, or when working on D itself:

  • DustMite can reduce a large program to a small one by performing reductions which satisfy a given condition (e.g. that a certain error message is reproduced).
  • Digger can build D, including old versions of D, and bisect D's history to find which commit fixed or introduced a bug.
  • TrenD ("Is D slim yet?") measures and visualizes D's history across a number of parameters.