Ignore:
Timestamp:
Mar 14, 2001, 7:57:34 PM (24 years ago)
Author:
umoeller
Message:

misc changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dosh.c

    r46 r48  
    16611661 *
    16621662 *@@added V0.9.7 (2000-12-02) [umoeller]
     1663 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt loads; thanks phaller
    16631664 */
    16641665
     
    17201721                                else
    17211722                                {
    1722                                     pPerfSys->palLoads = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG));
    1723                                     if (!pPerfSys->palLoads)
     1723                                    pPerfSys->padIntrPrev
     1724                                        = (double*)malloc(pPerfSys->cProcessors * sizeof(double));
     1725                                    if (!pPerfSys->padIntrPrev)
    17241726                                        arc = ERROR_NOT_ENOUGH_MEMORY;
    17251727                                    else
    17261728                                    {
    1727                                         for (ul = 0; ul < pPerfSys->cProcessors; ul++)
     1729                                        pPerfSys->palLoads = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG));
     1730                                        if (!pPerfSys->palLoads)
     1731                                            arc = ERROR_NOT_ENOUGH_MEMORY;
     1732                                        else
    17281733                                        {
    1729                                             pPerfSys->padBusyPrev[ul] = 0.0;
    1730                                             pPerfSys->padTimePrev[ul] = 0.0;
    1731                                             pPerfSys->palLoads[ul] = 0;
     1734            // **patrick, this was missing...
     1735            // wonder if you ever tested this, this crashes in
     1736            // doshPerfGet otherwise ;-)
     1737            /*   -----------> */            pPerfSys->palIntrs = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG));
     1738                                            if (!pPerfSys->palIntrs)
     1739                                                arc = ERROR_NOT_ENOUGH_MEMORY;
     1740                                            else
     1741                                            {
     1742                                                for (ul = 0; ul < pPerfSys->cProcessors; ul++)
     1743                                                {
     1744                                                    pPerfSys->padBusyPrev[ul] = 0.0;
     1745                                                    pPerfSys->padTimePrev[ul] = 0.0;
     1746                                                    pPerfSys->padIntrPrev[ul] = 0.0;
     1747                                                    pPerfSys->palLoads[ul] = 0;
     1748            /* and this one too */                  pPerfSys->palIntrs[ul] = 0;
     1749                                                }
     1750                                            }
    17321751                                        }
    17331752                                    }
     
    17771796 *
    17781797 *@@added V0.9.7 (2000-12-02) [umoeller]
     1798 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt loads; thanks phaller
    17791799 */
    17801800
     
    18011821                double      dBusy = LL2F(pCPUUtilThis->ulBusyHigh,
    18021822                                         pCPUUtilThis->ulBusyLow);
     1823                double      dIntr = LL2F(pCPUUtilThis->ulIntrHigh,
     1824                                         pCPUUtilThis->ulIntrLow);
    18031825
    18041826                double      *pdBusyPrevThis = &pPerfSys->padBusyPrev[ul];
    18051827                double      *pdTimePrevThis = &pPerfSys->padTimePrev[ul];
     1828                double      *pdIntrPrevThis = &pPerfSys->padIntrPrev[ul];
    18061829
    18071830                // avoid division by zero
    18081831                double      dTimeDelta = (dTime - *pdTimePrevThis);
    18091832                if (dTimeDelta)
     1833                {
    18101834                    pPerfSys->palLoads[ul]
    18111835                        = (LONG)( (double)(   (dBusy - *pdBusyPrevThis)
     
    18141838                                          )
    18151839                                );
     1840                    pPerfSys->palIntrs[ul]
     1841                        = (LONG)( (double)(   (dIntr - *pdIntrPrevThis)
     1842                                            / dTimeDelta
     1843                                            * 1000.0
     1844                                          )
     1845                                );
     1846                }
    18161847                else
     1848                {
     1849                    // no clear readings are available
    18171850                    pPerfSys->palLoads[ul] = 0;
     1851                    pPerfSys->palIntrs[ul] = 0;
     1852                }
    18181853
    18191854                *pdTimePrevThis = dTime;
    18201855                *pdBusyPrevThis = dBusy;
     1856                *pdIntrPrevThis = dIntr;
    18211857            }
    18221858        }
     
    18321868 *@@added V0.9.7 (2000-12-02) [umoeller]
    18331869 *@@changed V0.9.9 (2001-02-06) [umoeller]: removed disable; this broke the WarpCenter
     1870 *@@changed V0.9.9 (2001-03-14) [umoeller]: fixed memory leak
     1871 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt loads; thanks phaller
    18341872 */
    18351873
     
    18521890        if (pPerfSys->padTimePrev)
    18531891            free(pPerfSys->padTimePrev);
     1892        if (pPerfSys->padIntrPrev)
     1893            free(pPerfSys->padIntrPrev);
     1894        if (pPerfSys->palLoads)             // was missing V0.9.9 (2001-03-14) [umoeller]
     1895            free(pPerfSys->palLoads);
     1896        if (pPerfSys->palIntrs)
     1897            free(pPerfSys->palIntrs);
    18541898
    18551899        if (pPerfSys->hmod)
Note: See TracChangeset for help on using the changeset viewer.