Tools |
Collecting Metrics : Referencecom.jmetra.JMetraMaker [options] [output directory]
Parsing ErrorsAny parsing errors will show up as an error in the jmetra log file (see Logging). Details will be provided regarding the specifics of the parsing error. Usage ExamplesThe following are a collection of example usages to demonstrate the parameters in use. We assume all required jMetra are on the classpath. \bin>java com.jmetra.JMetraMaker -verbose -rootsource D:\proj\src java D:\proj\metrics
\bin>java com.jmetra.JMetraMaker -verbose -label build1 -rootsource D:\proj\src java D:\proj\metrics
\bin>java com.jmetra.JMetraMaker -verbose -label build1 -tstamp 2002.06.13.000000 -rootsource D:\proj\src java D:\proj\metrics
\bin>java com.jmetra.JMetraMaker -verbose -label build1 -tstampformat yyyy.MM.dd -tstamp 2002.06.13 -rootsource D:\proj\src java D:\proj\metrics
\bin>java com.jmetra.JMetraMaker -verbose -config projjmetraconfig.xml -rootsource D:\proj\src java D:\proj\metrics
Aggregating Metrics : Referencecom.jmetra.JMetraMaker -aggr [options] [metrics directory] [output directory]
Incremental Building of Aggregate MetricsSince generating jMetra documents with JMetraDoc requires the aggregrated metrics, the aggregation command (reviewed in the above section) will need to be executed every time you want to include new metrics (from new builds) in the jMetra Doc. It is important to note that the aggregation command is given a directory to locate the individual metrics files generated over time. JMetraMaker -aggr will automatically run through all the metrics XML files in the directory and attempt to aggregate each one into the existing aggregate metrics files. If an entry for that label does not exist then they are added to the aggregate metrics file for that class. As the aggregation is taking place, for each class, jMetra checks to see if the metrics with the same label are already in the file. If they are, jMetra will not add them again.Since jMetra will not add metrics with duplicate labels, you can always keep your metrics in the same directory and aggregate on this directory. As a result of how jMetra aggregation occurs, if you keep all your individual metrics files from each build, you can blow away your aggregate metrics and they can be totally regenerated as long as all the individual metrics files are in the same directory. This is good to keep in mind! Usage ExamplesThe following is a collection of example usages to demonstrate the parameters in use. We assume all required jMetra are on the classpath. \bin>java com.jmetra.JMetraMaker -aggr D:\proj\metrics D:\proj\metrics\aggr
\bin>java com.jmetra.JMetraMaker -aggr -config projconfig.xml D:\proj\metrics D:\proj\metrics\aggr
\bin>java com.jmetra.JMetraMaker -verbose -aggr D:\proj\metrics D:\proj\metrics\aggr
\bin>java com.jmetra.JMetraMaker -aggr -recent 5 D:\proj\metrics D:\proj\metrics\aggr
Code Metrics ContinuityAs a project evolves, it is not uncommon for project packages to be reorganized, or specific files to be moved to different packages. It is desirable for jMetra to tie together classes metrics using old class nameswith the new, currrent class names. Likewise, it is desirable to tie together class metrics between a group of classes with an old package name with the classes at the new package name. We solve this problem by not resolving changes in class names and package location changes until the aggregation stage. The jMetra config file contains a list of original and current package changes, and the time that these changes/renamings took place. You must take the responsability to generate this yourself. Also, by delaying this continuity processing until aggregation, you can always regenerate the aggregations if you incorrectly defined the mappings between new and old class names and packages and their new class names and locations. Example of Configuration file for Metrics ContinuityFor our project proj, let's say we moved a java package and its contents from com.xyzinc.proj.ui.servlets to com.xyzinc.proj.app.servlets on 3/15/02. Also, we renamed and moved a class com.xyzinc.proj.AppException to com.xyzinc.ApplicationException on 4/10/02. The continuity file <?xml version="1.0" encoding="UTF-8"?> would provide a continuity of the metrics. When aggregation occurs, metrics from the old packages and old class name would be added using the new packages and the new class name in the aggregated metrics files. Note that the aggregated XML file contains an original attribute when this occurs which contained the original full package name. Usage NotesMany projects using jMetra in a corporate environment often store the metrics aggregations on a shared, networked drive. Since the aggregation process is file-write intensive, aggregating new metrics files can take a substantially longer time. We have observed that performance for aggregating can take up to 10 times longer when writing to some networked drives. For this reason, we recommend that you put your metrics and aggregation files on a drive that is local to the platform where jMetra is executing. Users may still wish to write to a networked drive but should consider that aggregation performance is particularly sensative to drive access. Configuration NoteWhen updating the config.xml file with new package or class name/location changes, it is required that the aggregate files be generated from stratch. In other words, make sure you save all your build metrics fills for your project, blow away the \aggr directory, and aggregate all your build metrics files again. Any time you update the config.xml file, you must totally regenerate the aggregration files. |
![]() ![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||