Reports Examples

Simple Report Example

File: $VOVDIR/etc/lm/reports/report_simple.tcl
#!/bin/csh -f
# Copyright (c) 1995-2020, Altair Engineering
# All Rights Reserved.

# $Id: $

#  -*- Tcl -*- \
  exec vovsh -f $0 $*:q

###
### Example of a batch report for Monitor.
### You are welcome to take this script and modify it.
### 

VovDate::init

set interval "last month"
set interval "aug 2009"

set listOfFeatures "Virtuoso_Multi_mode_Simulation"
set listOfTags     "cadence cadence_gwan cadence_mmc cadence_wan"

# For my testing
set listOfFeatures "Compiler Complier lic_synth lic_drc"
set listOfTags     "EDA_1 DEMO"

set vovutils(verbose) 0

####################################
source $env(VOVDIR)/tcl/vtcl/vovlmreportlib.tcl
vtk_generic_get project projInfo
set topUrl   "http://$projInfo(host):$projInfo(port)"

VovDate::setInterval -interval $interval

VOVHTML_START

HTML {
    HEAD {
        TITLE "Report [clock format $VovDate::TIMERANGE(from)]"
        RAWOUT {
            <style>
            h2   { page-break-before: always }
            body { font-family:sans-serif    }
            .heatmapheader { background-color:white;font-family:sans-serif    }
            .heatmapcell   { font-family:sans-serif;font-size:80%             }
            .heatmaptitle  { font-family:sans-serif;background-color:\#BBBBFF }
            </style>
        }
    }
    BODY BGCOLOR="white" {
        TABLE BORDER=0 {
            TR { TD COLSPAN=2 { OUT "Report for tags $listOfTags" } }
            TR { TD COLSPAN=2 { OUT "Period of reporting: $interval" } }
            TR {
                TD { OUT "LicenseMonitor Project" }
                TD { 
                    HREF "$topUrl/cgi/ftlm.cgi?page=reports" "$projInfo(project)@$projInfo(host)" }
            }
            TR { 
                TD { OUT "From" } 
                TD { OUT "[clock format $VovDate::TIMERANGE(from)]" }
            }
            TR { 
                TD { OUT "To" } 
                TD { OUT "[clock format $VovDate::TIMERANGE(to)]" }
            }
            TR {
                TD COLSPAN=2 {
                    SMALL {
                        EM {
                            OUT "Generated with "
                            HREF "$topUrl/file?name=$argv0" [file tail $argv0] 
                            OUT " on "
                            OUT [clock format [clock seconds] -format "%x %X"]
                        }
                    }
                }
            }
        }

        HR

        #######################
        ### FEATURE REPORTS ###
        #######################

        H2 { OUT "Features in this report:" }
        OL { 
            foreach feature $listOfFeatures {
                LI { RAWOUT [subst {<a href="#$feature">$feature</a>}] }
            } 
        }

        # Individual feature reports
        foreach feature $listOfFeatures {
            HR
            H2 {
                RAWOUT [subst {<a name="$feature">Feature report for '$feature'</a>}]
            }

            ### Pie charts
            TABLE {
                foreach tag $listOfTags {
                    TR {
                        # Usage pie chart
                        TD VALIGN="TOP" {
                            VovLM::TABLEpieChart -feature $feature -tag $tag \
                                -type count -title "Count $tag/$feature" 
                        }
                        # Duration pie chart
                        TD VALIGN="TOP" {
                            VovLM::TABLEpieChart -feature $feature -tag $tag \
                                -type duration -title "Duration $tag/$feature"
                        }
                    }
                }
            }
            BR

            foreach tag $listOfTags {
                # Feature plot
                VovLM::TABLEplotFeature -tag $tag -feature $feature \
                    -width 500 -height 240 -title "Usage $tag/$feature"
                BR

                # Concurrent utilization plot
                if 0 {
                    VovLM::TABLEshowFeatureLevels -source 2 -tag $tag \
                        -feature $feature \
                        -title "Usage of feature $tag/$feature by level"; BR
                }
                # Denials
                set count [VovLM::countDenials -tag $tag -feature $feature ]
                if $count {
                    VovLM::TABLEplotDenials -tag $tag -feature $feature \
                        -width 500 -height 100 -title "Denials $tag/$feature"
                }

                if 0 {
                    # Checkins heatmap
                    VovLM::TABLEheatmap -tag $tag -feature $feature \
                        -type checkout -title "CheckOuts $tag/$feature"
                }
            }
        }
    }
}

VOVHTML_FINISH raw

exit 0

Tag Report Example

File: $VOVDIR/etc/lm/reports/report_tag.tcl
#!/bin/csh -f
# Copyright (c) 1995-2020, Altair Engineering
# All Rights Reserved.

# $Id: $

#  -*- Tcl -*- \
  exec vovsh -f $0 $*:q

###
### Example of a batch report for LicenseMonitor.
### You are welcome to take this script and modify it.
### 

VovDate::init
VovSQL::init
VovCGI::init
VovHtml::init
namespace import VovHtml::*

source $env(VOVDIR)/tcl/vtcl/vovlmreportlib.tcl

set usage {
    report_tag.tcl [OPTIONS]
    env QUERY_STRING=xxxxx report_tag.tcl

OPTIONS:
     tag        -- Tag to report on. Required.
     limit      -- Limit on number of rows in tables (default 60).
     max        -- Max number of plots (default all)
     interval   -- Interval of interest (default 'last month')
     rx         -- RegExp to filter features
     verbose    -- Verbosity level, for debugging.

EXAMPLES:
    % report_tag.tcl "tag=EDA&rx=lic"
    % env QUERY_STRING="tag=EDA&rx=lic" report_tag.tcl
}

set opt(interval)       "last month"
set opt(tag)            ""
set opt(rx)             ""
set opt(max)            0
set opt(verbose)        0
set opt(limit)          60

if { $argv == {} && ![info exists env(QUERY_STRING)] } {
    VovPrintUsage $usage
}

if { $argv != {} } {
    setenv QUERY_STRING $argv
}

setenv REQUEST_METHOD "GET"
VovCGI::parseQueryString

vtk_generic_get project projInfo
set topUrl   "http://$projInfo(host):$projInfo(port)"
set tag      $opt(tag)
set interval $opt(interval)
set featrx   $opt(rx)

VOVHTML_START

# set vovutils(verbose) 4
VovDate::setInterval -interval $interval

# Get tag ids
set tagIds [VovLM::processTagFilter TAGS $tag]

# Get feature ids
if { [info exists TAGS(allIds)] || $features != {} } {
    set DBHANDLE [VovSQL::open]
    VovSQL::getFeatureIdNameMap $DBHANDLE FEATURES -tagids $tagIds
    set featureIds $FEATURES(allIds)
}

# Get feature names
set listOfFeatures {}
foreach featureId $FEATURES(allIds) {
    lappend listOfFeatures $FEATURES(name,$featureId)
}

set VovLM::lmr_persistentGif 1

if { $featrx != "" } {
    set newList {}
    foreach f $listOfFeatures {
        if [regexp $featrx $f] {
            lappend newList $f
        }
    }
    set listOfFeatures $newList
}

# Handle limits
if { $opt(max) > 0 } { 
    set listOfFeatures [lrange $listOfFeatures 0 $opt(max)] 
}

set vovutils(verbose) $opt(verbose)

HTML {
    HEAD {
        TITLE "$tag License Usage Report [clock format $VovDate::TIMERANGE(from)]"
        RAWOUT {
            <link rel="StyleSheet" href="/html/wwwx.css" type="text/css">
            <style>
            h2   { page-break-before: always }
            body { font-family:sans-serif; background-color: white;   }
            .heatmapheader { background-color:white;font-family:sans-serif    }
            .heatmapcell   { font-family:sans-serif;font-size:80%             }
            .heatmaptitle  { font-family:sans-serif;background-color:#BBBBFF }
            .reportpage    { padding:4px;font-size:85%;background-color:#AAAAFF;color:#000000;font-family:sans-serif }
            </style>
        }
    }
    BODY BGCOLOR="white" {
        set now [clock seconds]

        H1 { 
            # A company_logo.gif file can be added 
            # in locationlicmon.swd/gif/company_logo.png
            RAWOUT "<img src=/gif/company_logo.png>"
            # RAWOUT "<img src=/gif/company_logo.gif height=40>"
            RAWOUT "&nbsp;"
            OUT "Tag $tag in $interval" 
        }

        TABLE BORDER=0 {
            TR {
                TD { OUT "LicenseMonitor Project" }
                TD {
                    set url   "$topUrl/cgi/ftlm.cgi?page=reports" 
                    set label "$projInfo(project)@$projInfo(host)" 
                    HREF $url $label
                }
            }
            TR { 
                TD { OUT "From" } 
                TD { OUT "[clock format $VovDate::TIMERANGE(from)]" }
            }
            TR { 
                TD { OUT "To" } 
                TD { OUT "[clock format $VovDate::TIMERANGE(to)]" }
            }
            TR {
                TD COLSPAN=2 {
                    SMALL {
                        EM {
                            OUT "Generated with "
                            HREF "$topUrl/file?name=$argv0" [file tail $argv0] 
                            OUT " on "
                            OUT [clock format [clock seconds] -format "%x %X"]
                        }
                    }
                }
            }
        }

        HR

        ###############
        ### SUMMARY ###
        ###############

        H2 { OUT "Summary for all features" } 

        VovLM::getCheckoutStats -reportby feature -tag $tag \
            -title "Report by Feature" -limit 30
        BR; BR
        VovLM::getCheckoutStats -reportby user    -tag $tag \
            -title "Report by User" -limit 20 
        BR; BR
        VovLM::getCheckoutStats -reportby host    -tag $tag \
            -title "Report by Host" -limit 20
        BR; BR
        VovLM::getCheckoutStats -reportby account -tag $tag \
            -title "Report by Account" -limit 20
        BR; BR

        H2 { OUT "Feature Statistics: $tag in $interval" } 
        VovLM::getFeatureStats -tag $tag \
            -showpeakavg 1 \
            -title "Feature Statistics For Tag $tag in $interval" -limit 30 

        H2 { OUT "Efficiency Summary: $tag in $interval" } 
        VovLM::getFeatureEfficiencyStats -tag $tag \
            -showidle 0 \
            -sortby use999pct \
            -title "Efficiency Summary For Tag $tag in $interval" -limit 30 

        HR

        #######################
        ### FEATURE REPORTS ###
        #######################

        # Print feature list
        RAWOUT [subst {<a name="list"><h2>Index of Features</h2></a>}]

        TABLE WIDTH="90%" BORDER="0" CELLPADDING="3" {
            set i 0
            foreach { f1 f2 f3 } [lsort -dictionary $listOfFeatures] {
                TR {
                    TD { if {$f1!=""} {OUT [incr i]; OUT ". "; RAWOUT [subst {<a href="#$f1">$f1</a>}] } }
                    TD { if {$f2!=""} {OUT [incr i]; OUT ". "; RAWOUT [subst {<a href="#$f2">$f2</a>}] } }
                    TD { if {$f3!=""} {OUT [incr i]; OUT ". "; RAWOUT [subst {<a href="#$f3">$f3</a>}] } }
                }
            }
        }

        # Individual feature reports
        foreach feature $listOfFeatures {
            HR
            H2 {}
            P class=reportpage {
                # RAWOUT "<img side=left src=/gif/gf_logo.gif height=20>  "
                BIG { RAWOUT [subst {<a name="$feature"></a>Feature '$tag/$feature'}]  }
                OUT " \[ "; 
                RAWOUT [subst {<a href="#list">back to list of features</a>}] ;
                OUT " \] "
            }

            ### Pie charts
            TABLE {
                TR {
                    # Usage pie chart
                    TD VALIGN="TOP" {
                        VovLM::getPieChart -feature $feature -tag $tag -type count \
                            -title "Count" 
                    }
                    # Duration pie chart
                    TD VALIGN="TOP" {
                        VovLM::getPieChart -feature $feature -tag $tag -type duration \
                            -title "Duration"
                    }
                }
            }
            BR

            # Feature plot from database.
            VovLM::getFeatureDetailedPlot -tag $tag -feature $feature \
                -showdet 1 -showcap 1 -showavg 1 -showcur 0 \
                -glitch 60 \
                -width 500 -height 250 -title "Usage of $feature"
            BR

            # Plot from resources logs.
            if { 0 } { 
                VovLM::getFeatureSamplingPlot -tag $tag -feature $feature \
                    -showdet 1 -showcap 1 -showavg 1 -showcur 0 \
                    -width 500 -height 300 -title "Usage $feature (from samples)"
                BR
            }

            BR
            VovLM::getCheckoutStats -reportby user   \
                -title "Report by User for $feature" -limit 20 \
                -tag $tag -feature $feature

            BR
            VovLM::getCheckoutStats -reportby account   \
                -title "Report by Account for $feature" -limit 20 \
                -tag $tag -feature $feature

            # Concurrent utilization plot
            VovLM::getFeatureLevels -tag $tag -feature $feature \
                -output html \
                -origin "merged" \
                -maxrows 15 \
                -title "Usage of feature $feature by level"

            # Denials
            set count [VovLM::countDenials -tag $tag -feature $feature ]
            if $count {
                VovLM::getDenialPlot -tag $tag -feature $feature \
                    -width 500 -height 100 -title "Denials $feature"
            }

            # Checkins heatmap
            # VovLM::TABLEheatmap -tag $tag -feature $feature -type checkin  -title "CheckIns"
            VovLM::getHeatmap  -tag $tag -feature $feature \
                -origin      samples \
                -output      html \
                -shownumbers 0 \
                -type checkout -title "CheckOuts"
        }
    }
}

VOVHTML_FINISH raw

exit 0