Commit bc5a0f85 authored by malenov's avatar malenov
Browse files

Further modifications to the complexity scripts

parent a90ac799
Loading
Loading
Loading
Loading
+0 −220
Original line number Diff line number Diff line
#!/bin/tcsh

# (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository. All Rights Reserved.

# This software is protected by copyright law and by international treaties.
# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository retain full ownership rights in their respective contributions in
# the software. This notice grants no license of any kind, including but not limited to patent
# license, nor is any license granted by implication, estoppel or otherwise.

# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
# contributions.

# This software is provided "AS IS", without any express or implied warranties. The software is in the
# development stage. It is intended exclusively for experts who have experience with such software and
# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
# and fitness for a particular purpose are hereby disclaimed and excluded.

# Any dispute, controversy or claim arising under or in relation to providing this software shall be
# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.

set maxValues = 40

if (${#argv} != 3) then
  echo usage: $0 \<input log\> \<output js file\> \<graph name\>
  exit
endif

set srcFile1    = $1

set file_final = $2
set file       = ${file_final}_new_$$

set graphName  = $3

set tmpBase    = `basename $0`
set tmpFile1   = /tmp/${tmpBase}1_$$
rm -f ${tmpFile1}
cat ${srcFile1} | tail -n ${maxValues} > ${tmpFile1}
set nLines1 = `cat ${tmpFile1} | wc -l`
set maxNumWordsLine = 7

rm -f $file
touch $file

echo "var $graphName = {"                      >> $file
echo '  prom_worstcase: {'                     >> $file
echo '    description: "Worst Case PROM",'     >> $file
echo '    direction: -1,'                      >> $file
echo '    runs: ['                             >> $file


@ i = 0
foreach line ( "`cat ${tmpFile1}`" )
  @ i++
  set separator = ","
  if ( $i == $nLines1 ) then
    set separator = "" 
  endif

  set tmp = ( $line )

  set numWords = `echo $tmp | wc -w`
  if ( $numWords < $maxNumWordsLine ) then
    continue
  endif

  set revision           = $tmp[1]
  set shortDate          = `echo $tmp[2] | sed -e "s/_/\ /g"`
  set fullDate           = `echo $tmp[3] | sed -e "s/_/\ /g"`
  set logFileFlc         = $tmp[5]
  set logFileBasop       = $tmp[7]

  echo '      {'                                            >> $file
  echo '        fullDate: "'${fullDate}'",'                 >> $file 
  echo '        shortDate: "'${shortDate}'",'               >> $file 
  echo '        revision: "'${revision}'",'                 >> $file 
  echo '        logFileFlc: "'${logFileFlc}'",'             >> $file 
  echo '        logFileBasop: "'${logFileBasop}'",'     >> $file 
  echo '      }'${separator}                                >> $file

end
echo '    ],'                                        >> $file

# begin displays
echo '    displays: ['                         >> $file

# requirement PROM		
echo '      {'                                 >> $file
echo '        lines: { show: false },'          >> $file
echo '        points: { show: false, fillColor: "#ffffff" },' >> $file
echo '        borderWidth: 1.5,'               >> $file
echo '        borderColor: "#BEBEBE",'         >> $file
echo '        markingsLineWidth: .75,'         >> $file
echo '        hoverable: true,'                >> $file
echo '        clickable: true,'                >> $file
echo '        shadowSize: 0,'                  >> $file
echo '        color: "#000000",'               >> $file
echo '        id: "requirementProm",'          >> $file
echo '        data: ['                         >> $file

@ i = 0
foreach line ( "`cat ${tmpFile1}`" )
  set separator = ","
  if ( $i == $nLines1 - 1 ) then
    set separator = "" 
  endif

  set tmp = ( $line )

  set numWords = `echo $tmp | wc -w`
  if ( $numWords < $maxNumWordsLine ) then
    continue
  endif

  # TODO: add real requirement once decided on
  set score = 0

  echo '          ['"${i}, ${score}"']'${separator}  >> $file
  @ i++

end

echo '        ]'                               >> $file
echo '      },'                                >> $file
# requirement ROM

# measured ops FLC	
echo '      {'                                 >> $file
echo '        lines: { show: true },'          >> $file
echo '        points: { show: true, fillColor: "#ffffff" },' >> $file
echo '        borderWidth: 1.5,'               >> $file
echo '        borderColor: "#BEBEBE",'         >> $file
echo '        markingsLineWidth: .75,'         >> $file
echo '        hoverable: true,'                >> $file
echo '        clickable: true,'                >> $file
echo '        shadowSize: 0,'                  >> $file
echo '        color: "#FF8000",'               >> $file
echo '        id: "promOpsFlc",'               >> $file
echo '        data: ['                         >> $file

@ i = 0
foreach line ( "`cat ${tmpFile1}`" )
  set separator = ","
  if ( $i == $nLines1 - 1 ) then
    set separator = "" 
  endif

  set tmp = ( $line )

  set numWords = `echo $tmp | wc -w`
  if ( $numWords < $maxNumWordsLine ) then
    continue
  endif

  set score = $tmp[4]

  echo '          ['"${i}, ${score}"']'${separator}  >> $file
  @ i++

end

echo '        ]'                               >> $file
echo '      },'                                >> $file
# measured ops FLC

# measured ops BASOP	
echo '      {'                                 >> $file
echo '        lines: { show: false },'          >> $file
echo '        points: { show: false, fillColor: "#ffffff" },' >> $file
echo '        borderWidth: 1.5,'               >> $file
echo '        borderColor: "#BEBEBE",'         >> $file
echo '        markingsLineWidth: .75,'         >> $file
echo '        hoverable: true,'                >> $file
echo '        clickable: true,'                >> $file
echo '        shadowSize: 0,'                  >> $file
echo '        color: "#0080FF",'               >> $file
echo '        id: "promOpsBasop",'             >> $file
echo '        data: ['                         >> $file

@ i = 0
foreach line ( "`cat ${tmpFile1}`" )
  set separator = ","
  if ( $i == $nLines1 - 1 ) then
    set separator = "" 
  endif

  set tmp = ( $line )

  set numWords = `echo $tmp | wc -w`
  if ( $numWords < $maxNumWordsLine ) then
    continue
  endif

  set score = $tmp[6]

  echo '          ['"${i}, ${score}"']'${separator}  >> $file
  @ i++

end

echo '        ]'                               >> $file
echo '      }'                                 >> $file

echo '    ]'                                   >> $file 
       
echo '  }'                                     >> $file
echo '};'                                      >> $file

mv -f $file $file_final
rm -f ${tmpFile1}
+0 −73
Original line number Diff line number Diff line
#!/usr/bin/env python3
# coding: utf-8
"""
   (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.
"""

import csv
import sys
import re

newsletterFilename = ""
newsletterFilenameLast = ""
revision = ""
shortDate = ""
fullDate = ""
maxPromOpsBasop = ""
logfileBasop = ""

if __name__ == "__main__":
    newsletterFilename = sys.argv[1]
    newsletterFilenameLast = sys.argv[2]
    revision = sys.argv[3]
    shortDate = sys.argv[4]
    fullDate = sys.argv[5]
    maxPromOpsBasop = sys.argv[6]
    logfileBasop = sys.argv[7]

max_total = ["", 0]

with open(newsletterFilename, "r") as csvfile:
    prom = csv.reader(csvfile, delimiter=";")
    for row in prom:
        if row[0] == "conf":
            continue
        if int(row[4]) > max_total[1]:
            max_total[0] = re.sub(" ", "_", row[0])
            max_total[1] = int(row[4])

print(
    revision,
    shortDate,
    fullDate,
    max_total[1],
    newsletterFilenameLast,
    maxPromOpsBasop,
    logfileBasop,
)
+42 −28
Original line number Diff line number Diff line
@@ -52,45 +52,43 @@ INSTRUMENTED_RESULTS = {
        "strip_suffix": False,
        "encdec": 2,
    },
    "SRAM": {
        "keyword": "Static RAM size",
    "HEAP": {
        "keyword": "Maximum inter-frame heap size:",
        "number_format": "{:.0f}",
        "position": 4,
        "position": 0,
        "max_or_add": "add",
        "keyword_suffix": True,
        "strip_suffix": True,
        "keyword_suffix": False,
        "strip_suffix": False,
        "encdec": 2,
    },
    "DRAM": {
        "keyword": "Stack size",
    "STACK": {
        "keyword": "Maximum stack size:",
        "number_format": "{:.0f}",
        "position": 3,
        "position": 0,
        "max_or_add": "max",
        "keyword_suffix": True,
        "strip_suffix": True,
        "keyword_suffix": False,
        "strip_suffix": False,
        "encdec": 2,
    },
    "PROM": {
        "keyword": "PROM size",
        "keyword": "Program ROM size",
        "number_format": "{:.0f}",
        "position": 3,
        "position": 0,
        "max_or_add": "add",
        "keyword_suffix": True,
        "strip_suffix": True,
        "encdec": 4,
    },
    "TABLES": {
        "keyword": "Table ROM size",
    "TROM": {
        "keyword": "Table ROM (const data) size",
        "number_format": "{:.0f}",
        "position": 4,
        "position": 0,
        "max_or_add": "add",
        "keyword_suffix": True,
        "strip_suffix": True,
        "encdec": 4,
    },
}


HTML_DOCTYPE = """<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"""

HTML_META = (
@@ -254,17 +252,17 @@ class IvasModeAnalyzer(IvasModeCollector):

    @staticmethod
    def get_log_value_from_file(
        filename: str, keyword: str, position: int, strip_suffix=0
        filename: str, keywords: list, position: int, strip_suffix=0
    ):
        """

        Parameters
        ----------
        filename :
        filename : log filename

        keyword :
        keywords : list of keywords to be searched in the log file (must be present on a single line)

        position :
        position : index to the list of extracted values

        strip_suffix :
             (Default value = 0)
@@ -272,14 +270,26 @@ class IvasModeAnalyzer(IvasModeCollector):
        Returns
        -------
        
        First value extracted from the line in the log file containing all keywords

        """
        loglines = []
        
        if type(keywords) != list:
            keywords = [keywords]
        
        if os.path.exists(filename):
            fp = open(filename)
            loglines = fp.readlines()
        return IvasModeAnalyzer.get_log_value(
            loglines, keyword, position, strip_suffix=strip_suffix
        )
            fp.close()
            matching_lines = [line for line in loglines if all(keyword in line for keyword in keywords)]  

            for line in matching_lines:
                all_values_on_line = [float(s) for s in line.split() if re.match(r'^[0-9\.]*$', s)]
                if all_values_on_line:
                    return all_values_on_line[position]
                
        return -1.0
            

    def sort_log_modes(self):
        list_to_sort = []
@@ -389,7 +399,7 @@ class IvasModeAnalyzer(IvasModeCollector):
                                enc_value,
                                self.get_log_value_from_file(
                                    enc_log_name,
                                    " ".join([keyword, "\(encoder\)"]),
                                    [keyword, "lib_enc"],
                                    position,
                                    strip_suffix=strip_suffix,
                                ),
@@ -411,7 +421,7 @@ class IvasModeAnalyzer(IvasModeCollector):
                            com_value,
                            self.get_log_value_from_file(
                                enc_log_name,
                                " ".join([keyword, "\(common\)"]),
                                [keyword, "lib_com"],
                                position,
                                strip_suffix=strip_suffix,
                            ),
@@ -435,7 +445,7 @@ class IvasModeAnalyzer(IvasModeCollector):
                                dec_value,
                                self.get_log_value_from_file(
                                    dec_log_name,
                                    " ".join([keyword, "\(decoder\)"]),
                                    [keyword, "lib_dec"],
                                    position,
                                    strip_suffix=strip_suffix,
                                ),
@@ -885,6 +895,10 @@ class IvasModeAnalyzer(IvasModeCollector):
        -------

        """
        
        if not os.path.exists(os.path.dirname(csv_file_name)):
            os.makedirs(os.path.dirname(csv_file_name))
        
        with open(csv_file_name + ".csv", "w", newline="\n") as f:
            header = result_table.pop(0)
            # write header