Changeset 48 for trunk/src/helpers/dosh.c
- Timestamp:
- Mar 14, 2001, 7:57:34 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh.c
r46 r48 1661 1661 * 1662 1662 *@@added V0.9.7 (2000-12-02) [umoeller] 1663 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt loads; thanks phaller 1663 1664 */ 1664 1665 … … 1720 1721 else 1721 1722 { 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) 1724 1726 arc = ERROR_NOT_ENOUGH_MEMORY; 1725 1727 else 1726 1728 { 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 1728 1733 { 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 } 1732 1751 } 1733 1752 } … … 1777 1796 * 1778 1797 *@@added V0.9.7 (2000-12-02) [umoeller] 1798 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt loads; thanks phaller 1779 1799 */ 1780 1800 … … 1801 1821 double dBusy = LL2F(pCPUUtilThis->ulBusyHigh, 1802 1822 pCPUUtilThis->ulBusyLow); 1823 double dIntr = LL2F(pCPUUtilThis->ulIntrHigh, 1824 pCPUUtilThis->ulIntrLow); 1803 1825 1804 1826 double *pdBusyPrevThis = &pPerfSys->padBusyPrev[ul]; 1805 1827 double *pdTimePrevThis = &pPerfSys->padTimePrev[ul]; 1828 double *pdIntrPrevThis = &pPerfSys->padIntrPrev[ul]; 1806 1829 1807 1830 // avoid division by zero 1808 1831 double dTimeDelta = (dTime - *pdTimePrevThis); 1809 1832 if (dTimeDelta) 1833 { 1810 1834 pPerfSys->palLoads[ul] 1811 1835 = (LONG)( (double)( (dBusy - *pdBusyPrevThis) … … 1814 1838 ) 1815 1839 ); 1840 pPerfSys->palIntrs[ul] 1841 = (LONG)( (double)( (dIntr - *pdIntrPrevThis) 1842 / dTimeDelta 1843 * 1000.0 1844 ) 1845 ); 1846 } 1816 1847 else 1848 { 1849 // no clear readings are available 1817 1850 pPerfSys->palLoads[ul] = 0; 1851 pPerfSys->palIntrs[ul] = 0; 1852 } 1818 1853 1819 1854 *pdTimePrevThis = dTime; 1820 1855 *pdBusyPrevThis = dBusy; 1856 *pdIntrPrevThis = dIntr; 1821 1857 } 1822 1858 } … … 1832 1868 *@@added V0.9.7 (2000-12-02) [umoeller] 1833 1869 *@@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 1834 1872 */ 1835 1873 … … 1852 1890 if (pPerfSys->padTimePrev) 1853 1891 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); 1854 1898 1855 1899 if (pPerfSys->hmod)
Note:
See TracChangeset
for help on using the changeset viewer.