VirtualBox

Changeset 102072 in vbox


Ignore:
Timestamp:
Nov 12, 2023 11:12:13 PM (15 months ago)
Author:
vboxsync
Message:

VMM/IEM: A little python cleanup. bugref:10371

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8vePython.py

    r102071 r102072  
    3939# Standard python imports:
    4040import copy;
     41import sys;
    4142
    4243# Out python imports:
     
    516517                g_dUnsupportedMcStmtLastOneStats[sStmt] = [oVariation,];
    517518
    518     if (    len(dUnsupportedStmts) == 1 #in (1,2)
    519         and iai.McStmt.findStmtByNames(aoStmts,
    520                                        { 'IEM_MC_LOCAL': 1, 'IEM_MC_LOCAL_CONST': 1, 'IEM_MC_ARG': 1, 'IEM_MC_ARG_CONST': 1,
    521                                          'IEM_MC_ARG_LOCAL_REF': 1, 'IEM_MC_ARG_LOCAL_EFLAGS': 1, })):
    522         for sStmt in dUnsupportedStmts:
    523             if sStmt in g_dUnsupportedMcStmtLastOneVarStats:
    524                 g_dUnsupportedMcStmtLastOneVarStats[sStmt].append(oVariation);
    525             else:
    526                 g_dUnsupportedMcStmtLastOneVarStats[sStmt] = [oVariation,];
     519    #if (    len(dUnsupportedStmts) == 1 #in (1,2)
     520    #    and iai.McStmt.findStmtByNames(aoStmts,
     521    #                                   { 'IEM_MC_LOCAL': 1, 'IEM_MC_LOCAL_CONST': 1, 'IEM_MC_ARG': 1, 'IEM_MC_ARG_CONST': 1,
     522    #                                     'IEM_MC_ARG_LOCAL_REF': 1, 'IEM_MC_ARG_LOCAL_EFLAGS': 1, })):
     523    #    for sStmt in dUnsupportedStmts:
     524    #        if sStmt in g_dUnsupportedMcStmtLastOneVarStats:
     525    #            g_dUnsupportedMcStmtLastOneVarStats[sStmt].append(oVariation);
     526    #        else:
     527    #            g_dUnsupportedMcStmtLastOneVarStats[sStmt] = [oVariation,];
    527528
    528529    return None;
     530
     531
     532def displayStatistics(aoThreadedFuncs, sHostArch): # type (list(ThreadedFunction)) -> True
     533    """
     534    Displays statistics.
     535    """
     536    print('todo:', file = sys.stderr);
     537    cTotal  = 0;
     538    cNative = 0;
     539    for oThreadedFunction in aoThreadedFuncs:
     540        for oVariation in oThreadedFunction.aoVariations:
     541            cTotal += 1;
     542            oVariation.oNativeRecomp = analyzeVariantForNativeRecomp(oVariation, sHostArch);
     543            if oVariation.oNativeRecomp and oVariation.oNativeRecomp.isRecompilable():
     544                cNative += 1;
     545    print('todo: %.1f%% / %u out of %u threaded function variations are recompilable'
     546          % (cNative * 100.0 / cTotal, cNative, cTotal), file = sys.stderr);
     547    if g_dUnsupportedMcStmtLastOneStats:
     548        asTopKeys = sorted(g_dUnsupportedMcStmtLastOneStats, reverse = True,
     549                           key = lambda sSortKey: len(g_dUnsupportedMcStmtLastOneStats[sSortKey]))[:16];
     550        print('todo:', file = sys.stderr);
     551        print('todo: Top %s variations with one unsupported statement dependency:' % (len(asTopKeys),),
     552              file = sys.stderr);
     553        cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
     554        for sKey in asTopKeys:
     555            print('todo: %*s = %s (%s%s)'
     556                  % (cchMaxKey, sKey, len(g_dUnsupportedMcStmtLastOneStats[sKey]),
     557                     ', '.join([oVar.getShortName() for oVar in g_dUnsupportedMcStmtLastOneStats[sKey][:5]]),
     558                     ',...' if len(g_dUnsupportedMcStmtLastOneStats[sKey]) >= 5 else '', )
     559                     , file = sys.stderr);
     560
     561        asTopKeys = sorted(g_dUnsupportedMcStmtStats, reverse = True,
     562                           key = lambda sSortKey: g_dUnsupportedMcStmtStats[sSortKey])[:16];
     563        print('todo:', file = sys.stderr);
     564        print('todo: Top %d most used unimplemented statements:' % (len(asTopKeys),), file = sys.stderr);
     565        cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
     566        for i in range(0, len(asTopKeys), 2):
     567            print('todo:  %*s = %4d  %*s = %4d'
     568                  % ( cchMaxKey, asTopKeys[i],     g_dUnsupportedMcStmtStats[asTopKeys[i]],
     569                      cchMaxKey, asTopKeys[i + 1], g_dUnsupportedMcStmtStats[asTopKeys[i + 1]],),
     570                  file = sys.stderr);
     571        print('todo:', file = sys.stderr);
     572
     573    #if g_dUnsupportedMcStmtLastOneVarStats:
     574    #    asTopKeys = sorted(g_dUnsupportedMcStmtLastOneVarStats, reverse = True,
     575    #                       key = lambda sSortKey: len(g_dUnsupportedMcStmtLastOneVarStats[sSortKey]))[:16];
     576    #    print('todo:', file = sys.stderr);
     577    #    print('todo: Top %s variations with variables and 1-2 unsupported statement dependency:' % (len(asTopKeys),),
     578    #          file = sys.stderr);
     579    #    cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
     580    #    for sKey in asTopKeys:
     581    #        print('todo: %*s = %s (%s%s)'
     582    #              % (cchMaxKey, sKey, len(g_dUnsupportedMcStmtLastOneVarStats[sKey]),
     583    #                 ', '.join([oVar.getShortName() for oVar in g_dUnsupportedMcStmtLastOneVarStats[sKey][:5]]),
     584    #                 ',...' if len(g_dUnsupportedMcStmtLastOneVarStats[sKey]) >= 5 else '', )
     585    #                 , file = sys.stderr);
     586
     587    return True;
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py

    r102070 r102072  
    18411841        # Analyze the threaded functions and their variations for native recompilation.
    18421842        if fNativeRecompilerEnabled:
    1843             print('todo:', file = sys.stderr);
    1844             cTotal  = 0;
    1845             cNative = 0;
    1846             for oThreadedFunction in self.aoThreadedFuncs:
    1847                 for oVariation in oThreadedFunction.aoVariations:
    1848                     cTotal += 1;
    1849                     oVariation.oNativeRecomp = ian.analyzeVariantForNativeRecomp(oVariation, sHostArch);
    1850                     if oVariation.oNativeRecomp and oVariation.oNativeRecomp.isRecompilable():
    1851                         cNative += 1;
    1852             print('todo: %.1f%% / %u out of %u threaded function variations are recompilable'
    1853                   % (cNative * 100.0 / cTotal, cNative, cTotal), file = sys.stderr);
    1854             if ian.g_dUnsupportedMcStmtLastOneStats:
    1855                 asTopKeys = sorted(ian.g_dUnsupportedMcStmtLastOneStats, reverse = True,
    1856                                    key = lambda sSortKey: len(ian.g_dUnsupportedMcStmtLastOneStats[sSortKey]))[:16];
    1857                 print('todo:', file = sys.stderr);
    1858                 print('todo: Top %s variations with one unsupported statement dependency:' % (len(asTopKeys),),
    1859                       file = sys.stderr);
    1860                 cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
    1861                 for sKey in asTopKeys:
    1862                     print('todo: %*s = %s (%s%s)'
    1863                           % (cchMaxKey, sKey, len(ian.g_dUnsupportedMcStmtLastOneStats[sKey]),
    1864                              ', '.join([oVar.getShortName() for oVar in ian.g_dUnsupportedMcStmtLastOneStats[sKey][:5]]),
    1865                              ',...' if len(ian.g_dUnsupportedMcStmtLastOneStats[sKey]) >= 5 else '', )
    1866                              , file = sys.stderr);
    1867 
    1868                 asTopKeys = sorted(ian.g_dUnsupportedMcStmtStats, reverse = True,
    1869                                    key = lambda sSortKey: ian.g_dUnsupportedMcStmtStats[sSortKey])[:16];
    1870                 print('todo:', file = sys.stderr);
    1871                 print('todo: Top %d most used unimplemented statements:' % (len(asTopKeys),), file = sys.stderr);
    1872                 cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
    1873                 for i in range(0, len(asTopKeys), 2):
    1874                     print('todo:  %*s = %4d  %*s = %4d'
    1875                           % ( cchMaxKey, asTopKeys[i],     ian.g_dUnsupportedMcStmtStats[asTopKeys[i]],
    1876                               cchMaxKey, asTopKeys[i + 1], ian.g_dUnsupportedMcStmtStats[asTopKeys[i + 1]],),
    1877                           file = sys.stderr);
    1878                 print('todo:', file = sys.stderr);
    1879 
    1880             if ian.g_dUnsupportedMcStmtLastOneVarStats:
    1881                 asTopKeys = sorted(ian.g_dUnsupportedMcStmtLastOneVarStats, reverse = True,
    1882                                    key = lambda sSortKey: len(ian.g_dUnsupportedMcStmtLastOneVarStats[sSortKey]))[:16];
    1883                 print('todo:', file = sys.stderr);
    1884                 print('todo: Top %s variations with variables and 1-2 unsupported statement dependency:' % (len(asTopKeys),),
    1885                       file = sys.stderr);
    1886                 cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
    1887                 for sKey in asTopKeys:
    1888                     print('todo: %*s = %s (%s%s)'
    1889                           % (cchMaxKey, sKey, len(ian.g_dUnsupportedMcStmtLastOneVarStats[sKey]),
    1890                              ', '.join([oVar.getShortName() for oVar in ian.g_dUnsupportedMcStmtLastOneVarStats[sKey][:5]]),
    1891                              ',...' if len(ian.g_dUnsupportedMcStmtLastOneVarStats[sKey]) >= 5 else '', )
    1892                              , file = sys.stderr);
    1893 
     1843            ian.displayStatistics(self.aoThreadedFuncs, sHostArch);
    18941844
    18951845        # Gather arguments + variable statistics for the MC blocks.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette