You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mmetrics.html 5.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>MMetrics Task</title>
  5. </head>
  6. <body>
  7. <h2>MMetrics</h2>
  8. <p>by</p>
  9. <ul>
  10. <li>Stephane Bailliez (<a href="mailto:sbailliez@imediation.com">sbailliez@imediation.com</a>)</li>
  11. </ul>
  12. <h3>Requirements</h3>
  13. <p>This task requires Metamata Development environment 2.0/Webgain Quality Analyzer 2.0.
  14. An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer">Webgain</a>.
  15. (Though you will not be able to use Metrics from the command line if you do not have a registered version).
  16. You also need a TRaX compliant processor(such as <a href="http://xml.apache.org/xalan-j">Xalan 2.x</a>) via JAXP 1.1</p>
  17. <h3>Description</h3>
  18. <p>
  19. Invokes the Metamata Metrics / WebGain Quality Analyzer source code
  20. analyzer on a set of Java files.
  21. </p>
  22. <p>
  23. <i>mmetrics</i> will compute the metrics of a set of Java files and write the results to an XML
  24. file. As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file.
  25. </p>
  26. <h3>Parameters</h3>
  27. <table border="1" cellpadding="2" cellspacing="0">
  28. <tr>
  29. <td valign="top"><b>Attribute</b></td>
  30. <td valign="top"><b>Description</b></td>
  31. <td align="center" valign="top"><b>Required</b></td>
  32. </tr>
  33. <tr>
  34. <td valign="top">metamatahome</td>
  35. <td valign="top">The home directory containing the Metamata distribution.</td>
  36. <td valign="top" align="center">Yes</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">tofile</td>
  40. <td valign="top">The XML were the resulting metrics will be written to.</td>
  41. <td valign="top" align="center">Yes</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">granularity</td>
  45. <td valign="top">Metrics granularity of the source files. Must be either
  46. <i>files</i> (compilation-units), <i>types</i> (types and compilation-units) or <i>methods</i>
  47. (methods, types and compilation-units).
  48. </td>
  49. <td valign="top" align="center">Yes</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">maxmemory</td>
  53. <td valign="top">Set the maximum memory for the JVM. this is a convenient
  54. way to set the -mx or -Xmx argument.</td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. </table>
  58. <h3>Nested elements</h3>
  59. For specifying the source code to analyze, you can either use a <tt>path</tt> or <tt>fileset</tt> elements (though a single path element is preferred, see note below).
  60. <h4>jvmarg</h4>
  61. <p>Additional parameters may be passed to the VM via nested <code>&lt;jvmarg&gt;</code>
  62. attributes. <code>&lt;jvmarg&gt;</code> allows all attributes described in <a href="../using.html#arg">Command
  63. line arguments</a>.</p>
  64. <h4>classpath</h4>
  65. <p>Sets class path (also source path unless one explicitly set). Overrides
  66. METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like
  67. structure</a>.</p>
  68. <h4>sourcepath</h4>
  69. <p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like
  70. structure</a>.</p>
  71. <h4>path</h4>
  72. <p>Sets the list of directories to analyze the code for metrics.;It represents a <a href="../using.html#path">PATH structure</a>.</p>
  73. <h4>fileset</h4>
  74. <p>Sets a set of files to analyze for metrics.source It represents a <a href="../CoreTypes/fileset.html">FILESET structure</a>.</p>
  75. <p>
  76. <font color="#FF0000">
  77. Note: For the sake of readability, it is highly recommended to analyze for a single unique directory instead than
  78. using filesets or several directories. Otherwise there will be multiple metrics outputs without any way to know
  79. what metrics refers to what source. Chance are also that the XML handler that does some heuristic will be confused
  80. by the different outputs.
  81. </font>
  82. </p>
  83. <h3>Example</h3>
  84. <pre> &lt;mmetrics target=&quot;mmetrics.xml&quot;
  85. metamatahome=&quot;c:/metamata&quot;
  86. granularity=&quot;methods&quot;&gt;
  87. &lt;classpath&gt;
  88. &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
  89. &lt;/classpath&gt;
  90. &lt;sourcepath&gt;
  91. &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
  92. &lt;/sourcepath&gt;
  93. &lt;path&gt;
  94. &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
  95. &lt;/path&gt;
  96. &lt;/mmetrics&gt;</pre>
  97. <p>
  98. This invokes Metamata Metrics installed in <tt>c:/metamata</tt> on the metrics example.
  99. (Note that here, classpath and sourcepath are not normally not needed)
  100. </p>
  101. <h3>Generating a report</h3>
  102. As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics.
  103. You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan extensions, you will need
  104. BSF, Xalan and Xerces to run it. The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated
  105. in the current directory), it can be run in Ant as follows:
  106. <pre>
  107. &lt;java classname=&quot;org.apache.xalan.xslt.Process&quot;&gt;
  108. &lt;param value=&quot;-IN&quot;/&gt;
  109. &lt;param value=&quot;${metrics.xml}&quot;/&gt;
  110. &lt;param value=&quot;-XSL&quot;/&gt;
  111. &lt;param value=&quot;mmetrics-frames.xsl&quot;/&gt;
  112. &lt;param value=&quot;-PARAM&quot;/&gt;
  113. &lt;param value=&quot;output.dir&quot;/&gt;
  114. &lt;param value=&quot;&amp;quot;'${report.dir}'&amp;quot;&quot;/&gt;
  115. &lt;/java&gt;
  116. </pre>
  117. </body>
  118. </html>