home.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Metrix++ Project</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <!-- Le styles -->
  10. <!--
  11. <link href="../../style.css" rel="stylesheet">
  12. -->
  13. <link href="assets/css/bootstrap.css" rel="stylesheet">
  14. <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
  15. <link href="assets/css/docs.css" rel="stylesheet">
  16. <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
  17. <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  18. <!--[if lt IE 9]>
  19. <script src="assets/js/html5shiv.js"></script>
  20. <![endif]-->
  21. <!-- Le fav and touch icons -->
  22. <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
  23. <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
  24. <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
  25. <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
  26. <link rel="shortcut icon" href="assets/ico/favicon.png">
  27. <!--
  28. <script type="text/javascript">
  29. var _gaq = _gaq || [];
  30. _gaq.push(['_setAccount', 'UA-146052-10']);
  31. _gaq.push(['_trackPageview']);
  32. (function() {
  33. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  34. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  35. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  36. })();
  37. </script>
  38. -->
  39. </head>
  40. <body data-spy="scroll" data-target=".bs-docs-sidebar">
  41. <!-- Navbar
  42. ================================================== -->
  43. <div class="navbar navbar-link navbar-fixed-top">
  44. <div class="navbar-inner">
  45. <div class="container">
  46. <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  47. <span class="icon-bar"></span>
  48. <span class="icon-bar"></span>
  49. <span class="icon-bar"></span>
  50. </button>
  51. <a class="brand" href="./index.html">Metrix++</a>
  52. <div class="nav-collapse collapse">
  53. <ul class="nav">
  54. <li class="">
  55. <a href="./index.html">Home</a>
  56. </li>
  57. <li class="">
  58. <a href="./customize.html"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=275605&amp;type=10" alt="Get Software Index at SourceForge.net. Fast, secure and Free Open Source software downloads" border="0"></a>
  59. </li>
  60. </ul>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- Subhead
  66. ================================================== -->
  67. <header class="jumbotron" id="overview">
  68. <div id="myCarousel" class="carousel slide">
  69. <div class="carousel-inner">
  70. <div class="item active">
  71. <img src="assets/img/slide-01.jpg" alt="">
  72. <div class="container">
  73. <div class="carousel-caption">
  74. <h2>Multiple languages</h2>
  75. <p class="lead">&middot; C/C++, C# and Java.</p>
  76. <p class="lead">&middot; Recognises classes, interfaces, namespaces, functions, comments, preprocessor and much more.</p>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="item">
  81. <img src="assets/img/slide-02.jpg" alt="">
  82. <div class="container">
  83. <div class="carousel-caption">
  84. <h2>Multiple metrics</h2>
  85. <p class="lead">&middot; Complexity, size and other.</p>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="item">
  90. <img src="assets/img/slide-03.jpg" alt="">
  91. <div class="container">
  92. <div class="carousel-caption">
  93. <h2>High performance and scalability</h2>
  94. <p class="lead">&middot; Applicable to huge code bases: thousands of files per minute.</p>
  95. <p class="lead">&middot; Ultra-fast feedback on iterative re-run.</p>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="item">
  100. <img src="assets/img/slide-01.jpg" alt="">
  101. <div class="container">
  102. <div class="carousel-caption">
  103. <h2>Effortless application to legacy code</h2>
  104. <p class="lead">&middot; Recognises legacy, modified and new code.</p>
  105. <p class="lead">&middot; Prevents from negative trends. Encourages positive.</p>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="item">
  110. <img src="assets/img/slide-02.jpg" alt="">
  111. <div class="container">
  112. <div class="carousel-caption">
  113. <h2>Configurable</h2>
  114. <p class="lead">&middot; Define and apply your rules and policies.</p>
  115. <p class="lead">&middot; Integrate with your workflow.</p>
  116. </div>
  117. </div>
  118. </div>
  119. <div class="item">
  120. <img src="assets/img/slide-03.jpg" alt="">
  121. <div class="container">
  122. <div class="carousel-caption">
  123. <h2>Extendable via plugins</h2>
  124. <p class="lead">&middot; Define your custom metric.</p>
  125. <p class="lead">&middot; Add new language parser.</p>
  126. <p class="lead">&middot; Create advanced post-analysis tool.</p>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
  132. <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
  133. </div>
  134. <div class="container">
  135. <div class="row">
  136. <div class="span3">
  137. </div>
  138. <div class="span9">
  139. <h5 class="text-right">Management of source code quality is possible.</h5>
  140. <p class="text-right">
  141. <a href="https://sourceforge.net/projects/metrixplusplus/files/latest/download"
  142. ><button type="button"class="btn btn-danger">Download</button></a>
  143. <!--
  144. <button type="button"class="btn btn-warning">Donate</button>
  145. -->
  146. </p>
  147. </div>
  148. </div>
  149. </div>
  150. </header>
  151. <div class="container"><div class="row">
  152. <!-- Docs nav
  153. ================================================== -->
  154. <div class="span3 bs-docs-sidebar">
  155. <ul class="nav nav-list bs-docs-sidenav">
  156. <!--<li><img src="../../logo_project.png"/><p>&nbsp;</p></li>-->
  157. <li><a href="#overview_section"><i class="icon-chevron-right"></i> Overview</a></li>
  158. <li><a href="#download_section"><i class="icon-chevron-right"></i> Download &amp; Install</a></li>
  159. <li><a href="#workflow_collect_section"><i class="icon-chevron-right"></i> Workflow: Collect data</a></li>
  160. <li><a href="#workflow_view_section"><i class="icon-chevron-right"></i> Workflow: View data</a></li>
  161. <li><a href="#workflow_view_summary_section"><i class="icon-hand-right"></i> &middot; summary &amp; distributions</a></li>
  162. <li><a href="#workflow_view_details_section"><i class="icon-hand-right"></i> &middot; details per file/region</a></li>
  163. <li><a href="#workflow_limit_section"><i class="icon-chevron-right"></i> Workflow: Apply thresholds</a></li>
  164. <li><a href="#workflow_limit_hotspots_section"><i class="icon-hand-right"></i> &middot; hotspots</a></li>
  165. <li><a href="#workflow_limit_control_section"><i class="icon-hand-right"></i> &middot; controlling trends</a></li>
  166. <li><a href="#workflow_other_section"><i class="icon-chevron-right"></i> Workflow: Other applications</a></li>
  167. <li><a href="#extend_section"><i class="icon-chevron-right"></i> Create plugin</a></li>
  168. <li><a href="#contribute_section"><i class="icon-chevron-right"></i> Feedback &amp; Contribute</a></li>
  169. </ul>
  170. </div>
  171. <!-- Sections
  172. ================================================== -->
  173. <div class="span9">
  174. <!-- Overview
  175. ================================================== -->
  176. <section id="overview_section">
  177. <div class="page-header">
  178. <h1>Overview</h1>
  179. </div>
  180. <h3>Highlights</h3>
  181. <p>Metrix++ is a tool to collect and analyse code metrics. Any metric is useless if it is not used.
  182. Metrix++ offers great usage capabilities and assists with variety of application use cases:</p>
  183. <ul>
  184. <li>Monitoring trends on <strong>daily</strong> basis. In order to take actions or make right decisions earlier.</li>
  185. <li>Enforcing trends on <strong>hourly</strong> basis, at every commit of code changes. In order to control quality in time, i.e. when it is not too late to redo.</li>
  186. <li>Assisiting on <strong>per minute</strong> basis during code refactoring and code development, where coding and quality standards matter.</li>
  187. </ul>
  188. <p>The workflow sections below demonstarate basic application usecases.</p>
  189. <h3>Languages supported</h3>
  190. <p>The tool can parse C/C++, C# and Java source code files. The parser identifies certain regions in the code,
  191. such as classes, functions, namespaces, interfaces, etc. It obviously detects comments, strings and code for preprocessor.
  192. The identified regions form a tree of nested source code blocks, which are refered after and additionally scanned by metrics plugins.
  193. This concept allows to attribute metrics per regions, what gives fine grained data and rich input to analysis tools.
  194. The following example demonstrates regions concept.</p>
  195. <table class="table">
  196. <thead>
  197. <tr>
  198. <th>Source code</th>
  199. <th>Regions tree [type: name: content type]</th>
  200. </tr>
  201. </thead>
  202. <tbody>
  203. <tr>
  204. <td>
  205. <pre class="prettyprint linenums">
  206. // simple C++ code
  207. #include &lt;myapi.h&gt;
  208. // I explain the following class
  209. class MyClass {
  210. public:
  211. int m_var; // some member
  212. // I explain the following function
  213. MyClass(): m_var(0) {
  214. char str[] = "unused string"
  215. // nested region for good measure
  216. struct MyStruct {};
  217. }
  218. // Do not judge ugly code below
  219. #define get_max(a,b) ((a)>(b)?(a):(b))
  220. set_max(int b) {
  221. m_var = get_max(m_var, b);
  222. }
  223. };
  224. // this is the last line
  225. </pre>
  226. </td>
  227. <td>
  228. <pre class="prettyprint linenums">
  229. file: __global__: comment
  230. file: __global__: code
  231. file: __global__: preprocessor
  232. file: __global__: code
  233. class: MyClass: comment
  234. class: MyClass: code
  235. class: MyClass: code
  236. class: MyClass: code, comment
  237. class: MyClass: code
  238. function: MyClass: comment
  239. function: MyClass: code
  240. function: MyClass: code, string
  241. function: MyClass: code
  242. struct: MyStruct: comment
  243. struct: MyStruct: code
  244. function: MyClass: code
  245. class: MyClass: code
  246. function: set_max: comment
  247. function: set_max: preprocessor
  248. function: set_max: code
  249. function: set_max: code
  250. function: set_max: code
  251. class: MyClass: code
  252. file: __global__: comment
  253. </pre>
  254. </td>
  255. </tr>
  256. </tbody>
  257. </table>
  258. <h3>Metrics</h3>
  259. <p>Metrics highlighed in blue are <strong>per file</strong> metrics. Other metrics are <strong>per region</strong> metrics.
  260. Region term is explained in the previous chapter.</p>
  261. <table class="table table-bordered">
  262. <thead>
  263. <tr>
  264. <th>Metric (enable option)</th>
  265. <th>Brief description</th>
  266. <th>Motivation</th>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. <tr class="info">
  271. <td>std.general.size</td>
  272. <td>Size of a file in bytes.</td>
  273. <td rowspan="4"><ul><li>Monitoring growth of source code base.</li>
  274. <li>Normalizing other metrics.</li>
  275. <li>Preventing large files and regions (large things difficult to maintain).</li>
  276. <li>Predicting delivery dates by comparing
  277. <a href="http://www.compaid.com/caiInternet/casestudies/kanarticle2.pdf">S-shaped code base growth / change curves</a>.</li></ul></td>
  278. </tr>
  279. <tr>
  280. <td>std.code.length.total</td>
  281. <td>The same as 'std.general.size' metric, but attributed to code regions.</td>
  282. <td></td>
  283. </tr>
  284. <tr>
  285. <td>std.code.lines.total</td>
  286. <td>Number of non-blank lines of code of any content type (exectuable, comments, etc.)</td>
  287. <td></td>
  288. </tr>
  289. <tr>
  290. <td>std.code.lines.code</td>
  291. <td>Number of non-blank lines of code excluding preprocessor and comments.</td>
  292. <td></td>
  293. </tr>
  294. <tr>
  295. <td>std.code.lines.preprocessor</td>
  296. <td>Number of non-blank lines of preprocessor code.</td>
  297. <td><ul><li>Enforcing localisation of preprocessor code in a single place.</li>
  298. <li>Encouraging usage of safer code structures instead of preprocessor.</li></ul></td>
  299. </tr>
  300. <tr>
  301. <td>std.code.lines.comments</td>
  302. <td>Number of non-blank lines of comments.</td>
  303. <td><ul><li>Low number of comments may indicate about maintainability problems.</li></ul></td>
  304. </tr>
  305. <tr>
  306. <td>std.code.complexity.cyclomatic</td>
  307. <td>McCabe cyclomatic complexity metric.</td>
  308. <td><ul><li>Identification of highly complex code for review and refactoring.</li>
  309. <li>Preventing complex functions (complexity is a reason of many defects and a reason of expensive maintaintenance).</li></ul></td>
  310. </tr>
  311. <tr>
  312. <td>std.suppress</td>
  313. <td>An option enables collection of Metrix++ suppressions and 2 metrics: 'std.suppress:count' and
  314. 'std.suppress.file:count'. The first is number of suppressions per region.
  315. The second is the same but applies for file-scope metrics.</td>
  316. <td><ul><li>Suppressing false-positives.</li>
  317. <li>Managing the amount of suppressions. Usually there are no false-positives to suppress with the right metric,
  318. but could be exceptions in specific cases. Managing suppressions is about managing exceptions.
  319. If there are many exceptional cases, maybe something is wrong with a metric or an application of a metric.</li></ul></td>
  320. </tr>
  321. <tr class="info">
  322. <td>std.general.procerrors</td>
  323. <td>Number of errors detected by Metrix++ code parser.
  324. Errors, like mismatched brackets, may result in bad identification of regions.</td>
  325. <td><ul><li>Cleaning up errors to ensure reliable code scanning.</li></ul></td>
  326. </tr>
  327. <tr class="info">
  328. <td>std.general.proctime</td>
  329. <td>Seconds spent on processing a file.</td>
  330. <td><ul><li>Monitor and profile tool's performance.</li></ul></td>
  331. </tr>
  332. </tbody>
  333. </table>
  334. </section>
  335. <section id="download_section">
  336. <div class="page-header">
  337. <h1>Download &amp; Install</h1>
  338. </div>
  339. <p>In order to get the tool working, <a href="https://sourceforge.net/projects/metrixplusplus/files/latest/download">dowload the archive</a> with the latest stable version
  340. and unpack it to some folder. First run of the tool will trigger the installation within the folder,
  341. where it was launched.</p>
  342. <p>Corresponding checkout from the <a href="https://sourceforge.net/p/metrixplusplus/code">version control system</a> is the following:</p>
  343. <pre>svn checkout <a href="https://sourceforge.net/p/metrixplusplus/code">svn://svn.code.sf.net/p/metrixplusplus/code</a>/releases/latest Metrix++</pre>
  344. <p>In order to checkout the latest version under development, use this command:</p>
  345. <pre>svn checkout <a href="https://sourceforge.net/p/metrixplusplus/code">svn://svn.code.sf.net/p/metrixplusplus/code</a>/mainline Metrix++</pre>
  346. <h4>Prerequisites</h4>
  347. <p>Python Runtime Environment (version 2.7.* or later, version 3.* has not been tested)</p>
  348. <h4>License</h4>
  349. <p>This program is free software; you can redistribute it and/or modify it
  350. under the terms of the GNU General Public License as published by the
  351. Free Software Foundation; version 3 of the License.</p>
  352. <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  353. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  354. See the GNU General Public License for more details.</p>
  355. <p>You should have received a copy of the GNU General Public License along with the Metrix++;
  356. if not, contact <a href="mailto:avkonst@users.sourceforge.net?subject=Metrix%2B%2B License">Project Administrator</a></p>
  357. </section>
  358. <div class="page-header">
  359. <h1>Workflow</h1>
  360. </div>
  361. <p>The workflow and application usecases are demonstrated using source code of
  362. <a href="http://www.boost.org/doc/libs/1_54_0/doc/html/interprocess.html">boost/interprocess</a> library.
  363. Boost versions 1.52 and 1.54 are used and refered below as 'previous' and 'current' accordingly.</p>
  364. <section id="workflow_collect_section">
  365. <h2>Collect data</h2>
  366. <p>The first obvious step is to collect the data.
  367. The 'collect' tool has got multiple options to enable various metrics plugins.
  368. Let's collect number of lines of code and cyclomatic complexity metrics
  369. for the previous (1.52.0 version) boost interprocess library. Assuming that 2 versions of boost library
  370. are unpacked in the current working directory:</p>
  371. <pre>
  372. &gt; cd boost_1_52_0
  373. &gt; python "/path/to/metrix++.py" collect --std.code.lines.code --std.code.complexity.cyclomatic -- boost/interprocess
  374. &gt; cd ../ # return back to working directory
  375. </pre>
  376. <p>The list of arguments after '--' enumerates paths where to read source files.
  377. As a result of execution of this command, a file metrixpp.db will be written in the current working directory.
  378. It can be redefined with help of --db-file option.</p>
  379. <p>Metrix++ has got rich functionality in comparing code bases and reducing processing scope to modified or new code.
  380. So, let's collect the same data for the current (1.54.0 version) boost interprocess library.</p>
  381. <pre>
  382. &gt; cd boost_1_54_0
  383. &gt; python "/path/to/metrix++.py" collect --std.code.lines.code --std.code.complexity.cyclomatic -- boost/interprocess --db-file-prev=../boost_1_52_0/metrixpp.db
  384. &gt; cd ../ # return back to working directory
  385. </pre>
  386. <p>The option --db-file-prev points out to the file with data collected in the previous step.
  387. So, eventually it executed iterative collection. It can speed up the exectuion significantly,
  388. depending on amount of changes between two version.</p>
  389. <p>Check other options of the collect tool by executing:</p>
  390. <pre>
  391. &gt; python "/path/to/metrix++.py" collect --help
  392. </pre>
  393. </section>
  394. <section id="workflow_view_section">
  395. <h2>View data</h2>
  396. </section>
  397. <section id="workflow_view_summary_section">
  398. <h3>Summary metrics and distribution tables/graphs</h3>
  399. <p>It is time to look at the data. The command:</p>
  400. <pre>
  401. &gt; python "/path/to/metrix++.py" view --db-file=boost_1_54_0/metrixpp.db
  402. </pre>
  403. <p>prints summary metrics, like minimum/maximum, and distribution/frequency tables:</p>
  404. <pre>
  405. :: info: Overall metrics for 'std.code.complexity:cyclomatic' metric
  406. Average : 0.652902698283
  407. Minimum : 0
  408. Maximum : 37
  409. Total : 1597.0
  410. Distribution : 2446 regions in total (including 0 suppressed)
  411. Metric value : Ratio : R-sum : Number of regions
  412. 0 : 0.771 : 0.771 : 1886 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  413. 1 : 0.110 : 0.881 : 268 |||||||||||
  414. 2 : 0.044 : 0.925 : 108 ||||
  415. 3 : 0.025 : 0.949 : 60 ||
  416. 4 : 0.016 : 0.966 : 40 ||
  417. 5 : 0.007 : 0.973 : 18 |
  418. 6 : 0.006 : 0.979 : 14 |
  419. 7 : 0.004 : 0.983 : 10
  420. 8 : 0.003 : 0.986 : 8
  421. 9 : 0.002 : 0.988 : 4
  422. 10 : 0.004 : 0.991 : 9
  423. 11 : 0.002 : 0.993 : 4
  424. 12 : 0.001 : 0.994 : 3
  425. 13 : 0.001 : 0.995 : 2
  426. 14 : 0.001 : 0.996 : 2
  427. 15-16 : 0.001 : 0.997 : 3
  428. 17-18 : 0.001 : 0.998 : 3
  429. 20 : 0.000 : 0.999 : 1
  430. 23-25 : 0.001 : 1.000 : 2
  431. 37 : 0.000 : 1.000 : 1
  432. :: info: Overall metrics for 'std.code.lines:code' metric
  433. Average : 6.64356984479
  434. Minimum : 0
  435. Maximum : 201
  436. Total : 23970.0
  437. Distribution : 3608 regions in total (including 0 suppressed)
  438. Metric value : Ratio : R-sum : Number of regions
  439. 0-1 : 0.088 : 0.088 : 319 |||||||||
  440. 2 : 0.320 : 0.409 : 1155 ||||||||||||||||||||||||||||||||
  441. 3 : 0.108 : 0.517 : 390 |||||||||||
  442. 4 : 0.081 : 0.598 : 294 ||||||||
  443. 5 : 0.080 : 0.678 : 290 ||||||||
  444. 6 : 0.061 : 0.739 : 220 ||||||
  445. 7 : 0.049 : 0.788 : 176 |||||
  446. 8 : 0.030 : 0.818 : 109 |||
  447. 9 : 0.025 : 0.843 : 89 ||
  448. 10-11 : 0.032 : 0.876 : 117 |||
  449. 12-13 : 0.020 : 0.895 : 71 ||
  450. 14 : 0.012 : 0.907 : 43 |
  451. 15-16 : 0.017 : 0.924 : 61 ||
  452. 17-19 : 0.015 : 0.939 : 55 ||
  453. 20-22 : 0.013 : 0.952 : 46 |
  454. 23-26 : 0.011 : 0.963 : 40 |
  455. 27-30 : 0.009 : 0.972 : 33 |
  456. 31-39 : 0.009 : 0.981 : 33 |
  457. 40-65 : 0.009 : 0.991 : 34 |
  458. 66-201 : 0.009 : 1.000 : 33 |
  459. :: info: Directory content:
  460. Directory : .
  461. </pre>
  462. <p>The same command with --db-file-prev option enables comparision and change trends are shown in [] brackets:</p>
  463. <pre>
  464. &gt; python "/path/to/metrix++.py" view --db-file=boost_1_54_0/metrixpp.db --db-file-prev=boost_1_52_0/metrixpp.db
  465. </pre>
  466. <pre>
  467. :: info: Overall metrics for 'std.code.complexity:cyclomatic' metric
  468. Average : 0.652902698283 [+0.00362138411453]
  469. Minimum : 0 [+0]
  470. Maximum : 37 [+1]
  471. Total : 1597.0 [+16.0]
  472. Distribution : 2446 [+11] regions in total (including 0 [+0] suppressed)
  473. Metric value : Ratio : R-sum : Number of regions
  474. 0 : 0.771 : 0.771 : 1886 [+5 ] |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  475. 1 : 0.110 : 0.881 : 268 [+4 ] |||||||||||
  476. 2 : 0.044 : 0.925 : 108 [+0 ] ||||
  477. 3 : 0.025 : 0.949 : 60 [+2 ] ||
  478. 4 : 0.016 : 0.966 : 40 [-1 ] ||
  479. 5 : 0.007 : 0.973 : 18 [-1 ] |
  480. 6 : 0.006 : 0.979 : 14 [+1 ] |
  481. 7 : 0.004 : 0.983 : 10 [+1 ]
  482. 8 : 0.003 : 0.986 : 8 [+1 ]
  483. 9 : 0.002 : 0.988 : 4 [+0 ]
  484. 10 : 0.004 : 0.991 : 9 [-2 ]
  485. 11 : 0.002 : 0.993 : 4 [+1 ]
  486. 12 : 0.001 : 0.994 : 3 [+0 ]
  487. 13 : 0.001 : 0.995 : 2 [+0 ]
  488. 14 : 0.001 : 0.996 : 2 [+0 ]
  489. 15-16 : 0.001 : 0.997 : 3 [-1 ]
  490. 17-18 : 0.001 : 0.998 : 3 [+1 ]
  491. 20 : 0.000 : 0.999 : 1 [+0 ]
  492. 23-25 : 0.001 : 1.000 : 2 [+0 ]
  493. 36-37 : 0.000 : 1.000 : 1 [+0 ]
  494. :: info: Overall metrics for 'std.code.lines:code' metric
  495. Average : 6.64356984479 [+0.012181964309]
  496. Minimum : 0 [+0]
  497. Maximum : 201 [+4]
  498. Total : 23970.0 [+223.0]
  499. Distribution : 3608 [+27] regions in total (including 0 [+0] suppressed)
  500. Metric value : Ratio : R-sum : Number of regions
  501. 0-1 : 0.088 : 0.088 : 319 [+3 ] |||||||||
  502. 2 : 0.320 : 0.409 : 1155 [+9 ] ||||||||||||||||||||||||||||||||
  503. 3 : 0.108 : 0.517 : 390 [-3 ] |||||||||||
  504. 4 : 0.081 : 0.598 : 294 [+7 ] ||||||||
  505. 5 : 0.080 : 0.678 : 290 [+7 ] ||||||||
  506. 6 : 0.061 : 0.739 : 220 [-1 ] ||||||
  507. 7 : 0.049 : 0.788 : 176 [-2 ] |||||
  508. 8 : 0.030 : 0.818 : 109 [-1 ] |||
  509. 9 : 0.025 : 0.843 : 89 [+4 ] ||
  510. 10-11 : 0.032 : 0.876 : 117 [+9 ] |||
  511. 12-13 : 0.020 : 0.895 : 71 [-9 ] ||
  512. 14 : 0.012 : 0.907 : 43 [+0 ] |
  513. 15-16 : 0.017 : 0.924 : 61 [+0 ] ||
  514. 17-19 : 0.015 : 0.939 : 55 [+6 ] ||
  515. 20-22 : 0.013 : 0.952 : 46 [-3 ] |
  516. 23-26 : 0.011 : 0.963 : 40 [+2 ] |
  517. 27-30 : 0.009 : 0.972 : 33 [-3 ] |
  518. 31-39 : 0.009 : 0.981 : 33 [+0 ] |
  519. 40-65 : 0.009 : 0.991 : 34 [+1 ] |
  520. 66-201 : 0.009 : 1.000 : 33 [+1 ] |
  521. :: info: Directory content:
  522. Directory : .
  523. </pre>
  524. <h4>Reducing analysis scope</h4>
  525. <p>There are two ways to reduce the analysis scope for the view tool. The first is to enumerate paths of interest.
  526. For example, the following command reduces scope to 'allocators' sub-directory within the processed code.</p>
  527. <pre>
  528. &gt; python "/path/to/metrix++.py" view --db-file=boost_1_54_0/metrixpp.db -- ./boost/interprocess/allocators
  529. </pre>
  530. <p>The second is to specify --scope-mode option, which instructs the tool to process only modified and/or new files/regions.
  531. For example, view the summary metrics for all modified and new regions:</p>
  532. <pre>
  533. &gt; python "/path/to/metrix++.py" view --db-file=boost_1_54_0/metrixpp.db --db-file-prev=boost_1_52_0/metrixpp.db --scope-mode=touched
  534. </pre>
  535. <pre>
  536. :: info: Overall metrics for 'std.code.complexity:cyclomatic' metric
  537. Average : 1.84924623116 [-0.0230941943761]
  538. Minimum : 0 [+0]
  539. Maximum : 37 [+1]
  540. Total : 368.0 [+16.0]
  541. Distribution : 199 [+11] regions in total (including 0 [+0] suppressed)
  542. Metric value : Ratio : R-sum : Number of regions
  543. 0 : 0.608 : 0.608 : 121 [+5 ] |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  544. 1 : 0.131 : 0.739 : 26 [+4 ] |||||||||||||
  545. 2 : 0.070 : 0.809 : 14 [+0 ] |||||||
  546. 3 : 0.060 : 0.869 : 12 [+2 ] ||||||
  547. 4 : 0.015 : 0.884 : 3 [-1 ] ||
  548. 5 : 0.015 : 0.899 : 3 [-1 ] ||
  549. 6 : 0.005 : 0.905 : 1 [+1 ] |
  550. 7 : 0.015 : 0.920 : 3 [+1 ] ||
  551. 8 : 0.015 : 0.935 : 3 [+1 ] ||
  552. 9 : 0.010 : 0.945 : 2 [+0 ] |
  553. 10 : 0.010 : 0.955 : 2 [-2 ] |
  554. 11 : 0.005 : 0.960 : 1 [+1 ] |
  555. 12 : 0.005 : 0.965 : 1 [+0 ] |
  556. 13 : 0.005 : 0.970 : 1 [+0 ] |
  557. 16 : 0.005 : 0.975 : 1 [-1 ] |
  558. 17 : 0.005 : 0.980 : 1 [+0 ] |
  559. 18 : 0.010 : 0.990 : 2 [+1 ] |
  560. 20 : 0.005 : 0.995 : 1 [+0 ] |
  561. 36-37 : 0.005 : 1.000 : 1 [+0 ] |
  562. :: info: Overall metrics for 'std.code.lines:code' metric
  563. Average : 15.9645390071 [-0.815853149771]
  564. Minimum : 0 [+0]
  565. Maximum : 201 [+6]
  566. Total : 4502.0 [+223.0]
  567. Distribution : 282 [+27] regions in total (including 0 [+0] suppressed)
  568. Metric value : Ratio : R-sum : Number of regions
  569. 0-1 : 0.053 : 0.053 : 15 [+3 ] |||||
  570. 2 : 0.124 : 0.177 : 35 [+9 ] ||||||||||||
  571. 3 : 0.053 : 0.230 : 15 [-3 ] |||||
  572. 4 : 0.060 : 0.291 : 17 [+7 ] ||||||
  573. 5 : 0.089 : 0.379 : 25 [+7 ] |||||||||
  574. 6 : 0.060 : 0.440 : 17 [-1 ] ||||||
  575. 7 : 0.050 : 0.489 : 14 [-2 ] |||||
  576. 8-9 : 0.074 : 0.564 : 21 [+3 ] |||||||
  577. 10 : 0.035 : 0.599 : 10 [+5 ] ||||
  578. 11 : 0.082 : 0.681 : 23 [+4 ] ||||||||
  579. 12-13 : 0.043 : 0.723 : 12 [-9 ] ||||
  580. 14-15 : 0.039 : 0.762 : 11 [-1 ] ||||
  581. 16-18 : 0.028 : 0.791 : 8 [+4 ] |||
  582. 19-22 : 0.039 : 0.830 : 11 [+0 ] ||||
  583. 23-26 : 0.039 : 0.869 : 11 [+2 ] ||||
  584. 27-32 : 0.028 : 0.897 : 8 [-3 ] |||
  585. 38-50 : 0.025 : 0.922 : 7 [+0 ] ||
  586. 51-69 : 0.025 : 0.947 : 7 [+1 ] ||
  587. 71-100 : 0.032 : 0.979 : 9 [+2 ] |||
  588. 101-201 : 0.021 : 1.000 : 6 [-1 ] ||
  589. :: info: Directory content:
  590. Directory : .
  591. </pre>
  592. </section>
  593. <section id="workflow_view_details_section">
  594. <h3>Detailed metrics per file/region</h3>
  595. <p>The same view tool can print detailed metrics per file and per every region in the specified file.
  596. In order to get detailed metrics, enumerate files of interest after '--'. For example:</p>
  597. <pre>
  598. &gt; python "/path/to/metrix++.py" view --db-file=boost_1_54_0/metrixpp.db --db-file-prev=boost_1_52_0/metrixpp.db -- ./boost/interprocess/detail/managed_open_or_create_impl.hpp
  599. </pre>
  600. <p>produces output similar to this (truncated to make the page shorter):</p>
  601. <pre>
  602. ./interprocess/detail/managed_open_or_create_impl.hpp:302: info: Metrics per 'priv_open_or_create' region
  603. Region name : priv_open_or_create
  604. Region type : function
  605. Offsets : 8314-14526
  606. Line numbers : 301-467
  607. Modified : True
  608. std.code.complexity:cyclomatic: 37 [+1]
  609. std.code.lines:code: 148 [+4]
  610. </pre>
  611. </section>
  612. <section>
  613. <h3>More about the viewer</h3>
  614. <p>The 'view' command has got an option to alter the output format. It is possible to get the same data
  615. in xml pr python disctionary formats. This can be particularly useful for integration of the tool with
  616. other applications. For example, an editor may re-collect and show context based metrics when a file is saved.</p>
  617. <pre>
  618. &gt; python "/path/to/metrix++.py" view --format=xml
  619. </pre>
  620. <p>Check other options of the view tool by executing:</p>
  621. <pre>
  622. &gt; python "/path/to/metrix++.py" view --help
  623. </pre>
  624. </section>
  625. <section id="workflow_limit_section">
  626. <h2>Apply thresholds</h2>
  627. <p>...</p>
  628. </section>
  629. <section id="workflow_limit_hotspots_section">
  630. <h3>Suppressions</h3>
  631. <p>Metrix++ has got suppressions capability. Suppressions are collected from comments in code
  632. and used by post-processing tools, like 'limit'. It allows to take fine grained control
  633. over false-positive warnings, if there are.</p>
  634. </section>
  635. <section id="workflow_limit_control_section">
  636. <h3>Suppressions</h3>
  637. <p>Metrix++ has got suppressions capability. Suppressions are collected from comments in code
  638. and used by post-processing tools, like 'limit'. It allows to take fine grained control
  639. over false-positive warnings, if there are.</p>
  640. </section>
  641. <section id="extend_section">
  642. <div class="page-header">
  643. <h1>Create plugin</h1>
  644. </div>
  645. <h2>New metric</h2>
  646. <p>describe METRIXPLUSPLUS_PATH environment variable</p>
  647. <h2>New language</h2>
  648. <p>...</p>
  649. <h2>New analysis tool</h2>
  650. <p>...</p>
  651. </section>
  652. <section id="contribute_section">
  653. <div class="page-header">
  654. <h1>Feeback and contribute</h1>
  655. </div>
  656. <h2>Feedback</h2>
  657. <p>...</p>
  658. </section>
  659. </div> <!-- end for sections -->
  660. </div></div> <!-- end for row and container -->
  661. <!-- Footer
  662. ================================================== -->
  663. <footer class="footer">
  664. <div class="container">
  665. <p>Copyright <strong>&copy;</strong> 2009 - 2013, <a href="mailto:avkonst@users.sourceforge.net"><span class="normalImportance">Metrix++</span> Project</a></p>
  666. <p>Code licensed under <a href="http://www.gnu.org/licenses/gpl.txt" target="_blank">GPL 3.0</a>, documentation under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
  667. <ul class="footer-links">
  668. <li><a href="#">Report defect</a></li>
  669. <li class="muted">&middot;</li>
  670. <li><a href="#">Feature request</a></li>
  671. <li class="muted">&middot;</li>
  672. <li><a href="#">Known issues</a></li>
  673. <li class="muted">&middot;</li>
  674. <li><a href="#">Changelog</a></li>
  675. </ul>
  676. </div>
  677. </footer>
  678. <!-- Le javascript
  679. ================================================== -->
  680. <!-- Placed at the end of the document so the pages load faster -->
  681. <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
  682. <script src="assets/js/jquery.js"></script>
  683. <script src="assets/js/bootstrap-transition.js"></script>
  684. <script src="assets/js/bootstrap-alert.js"></script>
  685. <script src="assets/js/bootstrap-modal.js"></script>
  686. <script src="assets/js/bootstrap-dropdown.js"></script>
  687. <script src="assets/js/bootstrap-scrollspy.js"></script>
  688. <script src="assets/js/bootstrap-tab.js"></script>
  689. <script src="assets/js/bootstrap-tooltip.js"></script>
  690. <script src="assets/js/bootstrap-popover.js"></script>
  691. <script src="assets/js/bootstrap-button.js"></script>
  692. <script src="assets/js/bootstrap-collapse.js"></script>
  693. <script src="assets/js/bootstrap-carousel.js"></script>
  694. <script src="assets/js/bootstrap-typeahead.js"></script>
  695. <script src="assets/js/bootstrap-affix.js"></script>
  696. <script>
  697. !function ($) {
  698. $(function(){
  699. // carousel demo
  700. $('#myCarousel').carousel()
  701. })
  702. }(window.jQuery)
  703. </script>
  704. <script src="assets/js/holder/holder.js"></script>
  705. <script src="assets/js/google-code-prettify/prettify.js"></script>
  706. <script src="assets/js/application.js"></script>
  707. <script>
  708. </script>
  709. <!-- Analytics
  710. ================================================== -->
  711. <!--
  712. <script>
  713. var _gauges = _gauges || [];
  714. (function() {
  715. var t = document.createElement('script');
  716. t.type = 'text/javascript';
  717. t.async = true;
  718. t.id = 'gauges-tracker';
  719. t.setAttribute('data-site-id', '4f0dc9fef5a1f55508000013');
  720. t.src = '//secure.gaug.es/track.js';
  721. var s = document.getElementsByTagName('script')[0];
  722. s.parentNode.insertBefore(t, s);
  723. })();
  724. </script>
  725. -->
  726. </body>
  727. </html>