Removed the last of the C++ style comments. Adjusted the coding style a bit.

svn path=/trunk/; revision=7537
This commit is contained in:
Steven Edwards 2004-01-09 23:00:43 +00:00
parent 2c6c5f8a32
commit 7a53ba6050
20 changed files with 3043 additions and 3068 deletions

View file

@ -32,14 +32,11 @@
#include "taskmgr.h"
#include "about.h"
LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void OnAbout(void)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hMainWnd, (DLGPROC)AboutDialogWndProc);
}
LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

View file

@ -73,55 +73,55 @@ static void GraphCtrl_Init(TGraphCtrl* this)
this->m_dPreviousPosition[2] = 0.0;
this->m_dPreviousPosition[3] = 0.0;
// public variable for the number of decimal places on the y axis
/* public variable for the number of decimal places on the y axis */
this->m_nYDecimals = 3;
// set some initial values for the scaling until "SetRange" is called.
// these are protected varaibles and must be set with SetRange
// in order to ensure that m_dRange is updated accordingly
// m_dLowerLimit = -10.0;
// m_dUpperLimit = 10.0;
/* set some initial values for the scaling until "SetRange" is called.
* these are protected varaibles and must be set with SetRange
* in order to ensure that m_dRange is updated accordingly
*/
/* m_dLowerLimit = -10.0; */
/* m_dUpperLimit = 10.0; */
this->m_dLowerLimit = 0.0;
this->m_dUpperLimit = 100.0;
this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit; // protected member variable
this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit; /* protected member variable */
// m_nShiftPixels determines how much the plot shifts (in terms of pixels)
// with the addition of a new data point
/* m_nShiftPixels determines how much the plot shifts (in terms of pixels) */
/* with the addition of a new data point */
this->m_nShiftPixels = 4;
this->m_nHalfShiftPixels = this->m_nShiftPixels/2; // protected
this->m_nPlotShiftPixels = this->m_nShiftPixels + this->m_nHalfShiftPixels; // protected
this->m_nHalfShiftPixels = this->m_nShiftPixels/2; /* protected */
this->m_nPlotShiftPixels = this->m_nShiftPixels + this->m_nHalfShiftPixels; /* protected */
// background, grid and data colors
// these are public variables and can be set directly
this->m_crBackColor = RGB( 0, 0, 0); // see also SetBackgroundColor
this->m_crGridColor = RGB( 0, 255, 255); // see also SetGridColor
this->m_crPlotColor[0] = RGB(255, 255, 255); // see also SetPlotColor
this->m_crPlotColor[1] = RGB(100, 255, 255); // see also SetPlotColor
this->m_crPlotColor[2] = RGB(255, 100, 255); // see also SetPlotColor
this->m_crPlotColor[3] = RGB(255, 255, 100); // see also SetPlotColor
/* background, grid and data colors */
/* these are public variables and can be set directly */
this->m_crBackColor = RGB( 0, 0, 0); /* see also SetBackgroundColor */
this->m_crGridColor = RGB( 0, 255, 255); /* see also SetGridColor */
this->m_crPlotColor[0] = RGB(255, 255, 255); /* see also SetPlotColor */
this->m_crPlotColor[1] = RGB(100, 255, 255); /* see also SetPlotColor */
this->m_crPlotColor[2] = RGB(255, 100, 255); /* see also SetPlotColor */
this->m_crPlotColor[3] = RGB(255, 255, 100); /* see also SetPlotColor */
// protected variables
/* protected variables */
for (i = 0; i < MAX_PLOTS; i++)
{
this->m_penPlot[i] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[i]);
}
this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
// public member variables, can be set directly
strcpy(this->m_strXUnitsString, "Samples"); // can also be set with SetXUnits
strcpy(this->m_strYUnitsString, "Y units"); // can also be set with SetYUnits
/* public member variables, can be set directly */
strcpy(this->m_strXUnitsString, "Samples"); /* can also be set with SetXUnits */
strcpy(this->m_strYUnitsString, "Y units"); /* can also be set with SetYUnits */
// protected bitmaps to restore the memory DC's
/* protected bitmaps to restore the memory DC's */
this->m_bitmapOldGrid = NULL;
this->m_bitmapOldPlot = NULL;
}
#if 0
/////////////////////////////////////////////////////////////////////////////
TGraphCtrl::~TGraphCtrl()
{
// just to be picky restore the bitmaps for the two memory dc's
// (these dc's are being destroyed so there shouldn't be any leaks)
/* just to be picky restore the bitmaps for the two memory dc's */
/* (these dc's are being destroyed so there shouldn't be any leaks) */
if (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid);
if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot);
if (m_bitmapGrid != NULL) DeleteObject(m_bitmapGrid);
@ -132,7 +132,6 @@ TGraphCtrl::~TGraphCtrl()
}
#endif
/////////////////////////////////////////////////////////////////////////////
BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
{
BOOL result = 0;
@ -146,85 +145,78 @@ BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
return result;
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces)
{
//ASSERT(dUpper > dLower);
/* ASSERT(dUpper > dLower); */
this->m_dLowerLimit = dLower;
this->m_dUpperLimit = dUpper;
this->m_nYDecimals = nDecimalPlaces;
this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit;
this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
GraphCtrl_InvalidateCtrl(this);
}
#if 0
/////////////////////////////////////////////////////////////////////////////
void TGraphCtrl::SetXUnits(const char* string)
{
strncpy(m_strXUnitsString, string, sizeof(m_strXUnitsString) - 1);
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
InvalidateCtrl();
}
/////////////////////////////////////////////////////////////////////////////
void TGraphCtrl::SetYUnits(const char* string)
{
strncpy(m_strYUnitsString, string, sizeof(m_strYUnitsString) - 1);
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
InvalidateCtrl();
}
#endif
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color)
{
this->m_crGridColor = color;
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
GraphCtrl_InvalidateCtrl(this);
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color)
{
this->m_crPlotColor[plot] = color;
DeleteObject(this->m_penPlot[plot]);
this->m_penPlot[plot] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[plot]);
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
GraphCtrl_InvalidateCtrl(this);
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color)
{
this->m_crBackColor = color;
DeleteObject(this->m_brushBack);
this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
// clear out the existing garbage, re-start with a clean plot
/* clear out the existing garbage, re-start with a clean plot */
GraphCtrl_InvalidateCtrl(this);
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
{
// There is a lot of drawing going on here - particularly in terms of
// drawing the grid. Don't panic, this is all being drawn (only once)
// to a bitmap. The result is then BitBlt'd to the control whenever needed.
/* There is a lot of drawing going on here - particularly in terms of */
/* drawing the grid. Don't panic, this is all being drawn (only once) */
/* to a bitmap. The result is then BitBlt'd to the control whenever needed. */
int i, j;
int nCharacters;
int nTopGridPix, nMidGridPix, nBottomGridPix;
HPEN oldPen;
HPEN solidPen = CreatePen(PS_SOLID, 0, this->m_crGridColor);
//HFONT axisFont, yUnitFont, oldFont;
//char strTemp[50];
/* HFONT axisFont, yUnitFont, oldFont; */
/* char strTemp[50]; */
// in case we haven't established the memory dc's
//CClientDC dc(this);
/* in case we haven't established the memory dc's */
/* CClientDC dc(this); */
HDC dc = GetDC(this->m_hParentWnd);
// if we don't have one yet, set up a memory dc for the grid
/* if we don't have one yet, set up a memory dc for the grid */
if (this->m_dcGrid == NULL)
{
this->m_dcGrid = CreateCompatibleDC(dc);
@ -234,37 +226,38 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
SetBkColor(this->m_dcGrid, this->m_crBackColor);
// fill the grid background
/* fill the grid background */
FillRect(this->m_dcGrid, &this->m_rectClient, this->m_brushBack);
// draw the plot rectangle:
// determine how wide the y axis scaling values are
/* draw the plot rectangle: */
/* determine how wide the y axis scaling values are */
nCharacters = abs((int)log10(fabs(this->m_dUpperLimit)));
nCharacters = max(nCharacters, abs((int)log10(fabs(this->m_dLowerLimit))));
// add the units digit, decimal point and a minus sign, and an extra space
// as well as the number of decimal places to display
/* add the units digit, decimal point and a minus sign, and an extra space */
/* as well as the number of decimal places to display */
nCharacters = nCharacters + 4 + this->m_nYDecimals;
// adjust the plot rectangle dimensions
// assume 6 pixels per character (this may need to be adjusted)
// m_rectPlot.left = m_rectClient.left + 6*(nCharacters);
/* adjust the plot rectangle dimensions */
/* assume 6 pixels per character (this may need to be adjusted) */
/* m_rectPlot.left = m_rectClient.left + 6*(nCharacters); */
this->m_rectPlot.left = this->m_rectClient.left;
this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;//m_rectPlot.Width();
this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;/* m_rectPlot.Width(); */
// draw the plot rectangle
/* draw the plot rectangle */
oldPen = (HPEN)SelectObject(this->m_dcGrid, solidPen);
MoveToEx(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.top, NULL);
LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.top);
LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.bottom+1);
LineTo(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.bottom+1);
// LineTo(m_dcGrid, m_rectPlot.left, m_rectPlot.top);
/* LineTo(m_dcGrid, m_rectPlot.left, m_rectPlot.top); */
SelectObject(this->m_dcGrid, oldPen);
DeleteObject(solidPen);
// draw the dotted lines,
// use SetPixel instead of a dotted pen - this allows for a
// finer dotted line and a more "technical" look
/* draw the dotted lines,
* use SetPixel instead of a dotted pen - this allows for a
* finer dotted line and a more "technical" look
*/
nMidGridPix = (this->m_rectPlot.top + this->m_rectPlot.bottom)/2;
nTopGridPix = nMidGridPix - this->m_nPlotHeight/4;
nBottomGridPix = nMidGridPix + this->m_nPlotHeight/4;
@ -281,15 +274,15 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
for (j=this->m_rectPlot.top; j<this->m_rectPlot.bottom; j+=2)
{
SetPixel(this->m_dcGrid, i, j, this->m_crGridColor);
// SetPixel(m_dcGrid, i, j, m_crGridColor);
// SetPixel(m_dcGrid, i, j, m_crGridColor);
/* SetPixel(m_dcGrid, i, j, m_crGridColor); */
/* SetPixel(m_dcGrid, i, j, m_crGridColor); */
}
}
#if 0
// create some fonts (horizontal and vertical)
// use a height of 14 pixels and 300 weight
// (these may need to be adjusted depending on the display)
/* create some fonts (horizontal and vertical) */
/* use a height of 14 pixels and 300 weight */
/* (these may need to be adjusted depending on the display) */
axisFont = CreateFont (14, 0, 0, 0, 300,
FALSE, FALSE, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
@ -303,48 +296,48 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS, "Arial");
// grab the horizontal font
/* grab the horizontal font */
oldFont = (HFONT)SelectObject(m_dcGrid, axisFont);
// y max
/* y max */
SetTextColor(m_dcGrid, m_crGridColor);
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
sprintf(strTemp, "%.*lf", m_nYDecimals, m_dUpperLimit);
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, _tcslen(strTemp));
// y min
/* y min */
SetTextAlign(m_dcGrid, TA_RIGHT|TA_BASELINE);
sprintf(strTemp, "%.*lf", m_nYDecimals, m_dLowerLimit);
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, _tcslen(strTemp));
// x min
/* x min */
SetTextAlign(m_dcGrid, TA_LEFT|TA_TOP);
TextOut(m_dcGrid, m_rectPlot.left, m_rectPlot.bottom+4, "0", 1);
// x max
/* x max */
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp));
// x units
/* x units */
SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP);
TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString));
// restore the font
/* restore the font */
SelectObject(m_dcGrid, oldFont);
// y units
/* y units */
oldFont = (HFONT)SelectObject(m_dcGrid, yUnitFont);
SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE);
TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
(m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString));
SelectObject(m_dcGrid, oldFont);
#endif
// at this point we are done filling the the grid bitmap,
// no more drawing to this bitmap is needed until the setting are changed
/* at this point we are done filling the the grid bitmap, */
/* no more drawing to this bitmap is needed until the setting are changed */
// if we don't have one yet, set up a memory dc for the plot
/* if we don't have one yet, set up a memory dc for the plot */
if (this->m_dcPlot == NULL)
{
this->m_dcPlot = CreateCompatibleDC(dc);
@ -352,21 +345,20 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
this->m_bitmapOldPlot = (HBITMAP)SelectObject(this->m_dcPlot, this->m_bitmapPlot);
}
// make sure the plot bitmap is cleared
/* make sure the plot bitmap is cleared */
SetBkColor(this->m_dcPlot, this->m_crBackColor);
FillRect(this->m_dcPlot, &this->m_rectClient, this->m_brushBack);
// finally, force the plot area to redraw
/* finally, force the plot area to redraw */
InvalidateRect(this->m_hParentWnd, &this->m_rectClient, TRUE);
ReleaseDC(this->m_hParentWnd, dc);
}
/////////////////////////////////////////////////////////////////////////////
double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3)
{
// append a data point to the plot & return the previous point
/* append a data point to the plot & return the previous point */
double dPrevious;
dPrevious = this->m_dCurrentPosition[0];
@ -375,40 +367,39 @@ double GraphCtrl_AppendPoint(TGraphCtrl* this,
this->m_dCurrentPosition[2] = dNewPoint2;
this->m_dCurrentPosition[3] = dNewPoint3;
GraphCtrl_DrawPoint(this);
//Invalidate();
/* Invalidate(); */
return dPrevious;
}
////////////////////////////////////////////////////////////////////////////
void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
{
HDC memDC;
HBITMAP memBitmap;
HBITMAP oldBitmap; // bitmap originally found in CMemDC
HBITMAP oldBitmap; /* bitmap originally found in CMemDC */
// RECT rcClient;
// GetClientRect(hWnd, &rcClient);
// FillSolidRect(dc, &rcClient, RGB(255, 0, 255));
// m_nClientWidth = rcClient.right - rcClient.left;
// m_nClientHeight = rcClient.bottom - rcClient.top;
/* RECT rcClient; */
/* GetClientRect(hWnd, &rcClient); */
/* FillSolidRect(dc, &rcClient, RGB(255, 0, 255)); */
/* m_nClientWidth = rcClient.right - rcClient.left; */
/* m_nClientHeight = rcClient.bottom - rcClient.top; */
// no real plotting work is performed here,
// just putting the existing bitmaps on the client
/* no real plotting work is performed here, */
/* just putting the existing bitmaps on the client */
// to avoid flicker, establish a memory dc, draw to it
// and then BitBlt it to the client
/* to avoid flicker, establish a memory dc, draw to it */
/* and then BitBlt it to the client */
memDC = CreateCompatibleDC(dc);
memBitmap = (HBITMAP)CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
oldBitmap = (HBITMAP)SelectObject(memDC, memBitmap);
if (memDC != NULL)
{
// first drop the grid on the memory dc
/* first drop the grid on the memory dc */
BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcGrid, 0, 0, SRCCOPY);
// now add the plot on top as a "pattern" via SRCPAINT.
// works well with dark background and a light plot
BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcPlot, 0, 0, SRCPAINT); //SRCPAINT
// finally send the result to the display
/* now add the plot on top as a "pattern" via SRCPAINT. */
/* works well with dark background and a light plot */
BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcPlot, 0, 0, SRCPAINT); /* SRCPAINT */
/* finally send the result to the display */
BitBlt(dc, 0, 0, this->m_nClientWidth, this->m_nClientHeight, memDC, 0, 0, SRCCOPY);
}
SelectObject(memDC, oldBitmap);
@ -416,14 +407,13 @@ void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
DeleteDC(memDC);
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_DrawPoint(TGraphCtrl* this)
{
// this does the work of "scrolling" the plot to the left
// and appending a new data point all of the plotting is
// directed to the memory based bitmap associated with m_dcPlot
// the will subsequently be BitBlt'd to the client in Paint
/* this does the work of "scrolling" the plot to the left
* and appending a new data point all of the plotting is
* directed to the memory based bitmap associated with m_dcPlot
* the will subsequently be BitBlt'd to the client in Paint
*/
int currX, prevX, currY, prevY;
HPEN oldPen;
RECT rectCleanUp;
@ -431,52 +421,52 @@ void GraphCtrl_DrawPoint(TGraphCtrl* this)
if (this->m_dcPlot != NULL)
{
// shift the plot by BitBlt'ing it to itself
// note: the m_dcPlot covers the entire client
// but we only shift bitmap that is the size
// of the plot rectangle
// grab the right side of the plot (exluding m_nShiftPixels on the left)
// move this grabbed bitmap to the left by m_nShiftPixels
/* shift the plot by BitBlt'ing it to itself
* note: the m_dcPlot covers the entire client
* but we only shift bitmap that is the size
* of the plot rectangle
* grab the right side of the plot (exluding m_nShiftPixels on the left)
* move this grabbed bitmap to the left by m_nShiftPixels
*/
BitBlt(this->m_dcPlot, this->m_rectPlot.left, this->m_rectPlot.top+1,
this->m_nPlotWidth, this->m_nPlotHeight, this->m_dcPlot,
this->m_rectPlot.left+this->m_nShiftPixels, this->m_rectPlot.top+1,
SRCCOPY);
// establish a rectangle over the right side of plot
// which now needs to be cleaned up proir to adding the new point
/* establish a rectangle over the right side of plot */
/* which now needs to be cleaned up proir to adding the new point */
rectCleanUp = this->m_rectPlot;
rectCleanUp.left = rectCleanUp.right - this->m_nShiftPixels;
// fill the cleanup area with the background
/* fill the cleanup area with the background */
FillRect(this->m_dcPlot, &rectCleanUp, this->m_brushBack);
// draw the next line segement
/* draw the next line segement */
for (i = 0; i < MAX_PLOTS; i++)
{
// grab the plotting pen
/* grab the plotting pen */
oldPen = (HPEN)SelectObject(this->m_dcPlot, this->m_penPlot[i]);
// move to the previous point
/* move to the previous point */
prevX = this->m_rectPlot.right-this->m_nPlotShiftPixels;
prevY = this->m_rectPlot.bottom -
(long)((this->m_dPreviousPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
MoveToEx(this->m_dcPlot, prevX, prevY, NULL);
// draw to the current point
/* draw to the current point */
currX = this->m_rectPlot.right-this->m_nHalfShiftPixels;
currY = this->m_rectPlot.bottom -
(long)((this->m_dCurrentPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
LineTo(this->m_dcPlot, currX, currY);
// Restore the pen
/* Restore the pen */
SelectObject(this->m_dcPlot, oldPen);
// if the data leaks over the upper or lower plot boundaries
// fill the upper and lower leakage with the background
// this will facilitate clipping on an as needed basis
// as opposed to always calling IntersectClipRect
/* if the data leaks over the upper or lower plot boundaries
* fill the upper and lower leakage with the background
* this will facilitate clipping on an as needed basis
* as opposed to always calling IntersectClipRect
*/
if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top))
{
RECT rc;
@ -493,28 +483,27 @@ void GraphCtrl_DrawPoint(TGraphCtrl* this)
rc.left = prevX;
rc.right = currX+1;
rc.top = this->m_rectPlot.bottom+1;
//RECT rc(prevX, m_rectPlot.bottom+1, currX+1, m_rectClient.bottom+1);
/* RECT rc(prevX, m_rectPlot.bottom+1, currX+1, m_rectClient.bottom+1); */
FillRect(this->m_dcPlot, &rc, this->m_brushBack);
}
// store the current point for connection to the next point
/* store the current point for connection to the next point */
this->m_dPreviousPosition[i] = this->m_dCurrentPosition[i];
}
}
}
/////////////////////////////////////////////////////////////////////////////
void GraphCtrl_Resize(TGraphCtrl* this)
{
// NOTE: Resize automatically gets called during the setup of the control
/* NOTE: Resize automatically gets called during the setup of the control */
GetClientRect(this->m_hWnd, &this->m_rectClient);
// set some member variables to avoid multiple function calls
this->m_nClientHeight = this->m_rectClient.bottom - this->m_rectClient.top;//m_rectClient.Height();
this->m_nClientWidth = this->m_rectClient.right - this->m_rectClient.left;//m_rectClient.Width();
/* set some member variables to avoid multiple function calls */
this->m_nClientHeight = this->m_rectClient.bottom - this->m_rectClient.top;/* m_rectClient.Height(); */
this->m_nClientWidth = this->m_rectClient.right - this->m_rectClient.left;/* m_rectClient.Width(); */
// the "left" coordinate and "width" will be modified in
// InvalidateCtrl to be based on the width of the y axis scaling
/* the "left" coordinate and "width" will be modified in */
/* InvalidateCtrl to be based on the width of the y axis scaling */
#if 0
this->m_rectPlot.left = 20;
this->m_rectPlot.top = 10;
@ -527,21 +516,20 @@ void GraphCtrl_Resize(TGraphCtrl* this)
this->m_rectPlot.bottom = this->m_rectClient.bottom-0;
#endif
// set some member variables to avoid multiple function calls
this->m_nPlotHeight = this->m_rectPlot.bottom - this->m_rectPlot.top;//m_rectPlot.Height();
this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;//m_rectPlot.Width();
/* set some member variables to avoid multiple function calls */
this->m_nPlotHeight = this->m_rectPlot.bottom - this->m_rectPlot.top;/* m_rectPlot.Height(); */
this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;/* m_rectPlot.Width(); */
// set the scaling factor for now, this can be adjusted
// in the SetRange functions
/* set the scaling factor for now, this can be adjusted */
/* in the SetRange functions */
this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
}
#if 0
/////////////////////////////////////////////////////////////////////////////
void TGraphCtrl::Reset()
{
// to clear the existing data (in the form of a bitmap)
// simply invalidate the entire control
/* to clear the existing data (in the form of a bitmap) */
/* simply invalidate the entire control */
InvalidateCtrl();
}
#endif
@ -561,10 +549,10 @@ LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
{
case WM_ERASEBKGND:
return TRUE;
//
// Filter out mouse & keyboard messages
//
//case WM_APPCOMMAND:
/*
* Filter out mouse & keyboard messages
*/
/* case WM_APPCOMMAND: */
case WM_CAPTURECHANGED:
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
@ -576,7 +564,7 @@ LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
case WM_MOUSEHOVER:
case WM_MOUSELEAVE:
case WM_MOUSEMOVE:
//case WM_MOUSEWHEEL:
/* case WM_MOUSEWHEEL: */
case WM_NCHITTEST:
case WM_NCLBUTTONDBLCLK:
case WM_NCLBUTTONDOWN:
@ -584,21 +572,21 @@ LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
case WM_NCMBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
//case WM_NCMOUSEHOVER:
//case WM_NCMOUSELEAVE:
/* case WM_NCMOUSEHOVER: */
/* case WM_NCMOUSELEAVE: */
case WM_NCMOUSEMOVE:
case WM_NCRBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONUP:
//case WM_NCXBUTTONDBLCLK:
//case WM_NCXBUTTONDOWN:
//case WM_NCXBUTTONUP:
/* case WM_NCXBUTTONDBLCLK: */
/* case WM_NCXBUTTONDOWN: */
/* case WM_NCXBUTTONUP: */
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
//case WM_XBUTTONDBLCLK:
//case WM_XBUTTONDOWN:
//case WM_XBUTTONUP:
/* case WM_XBUTTONDBLCLK: */
/* case WM_XBUTTONDOWN: */
/* case WM_XBUTTONUP: */
case WM_ACTIVATE:
case WM_CHAR:
case WM_DEADCHAR:
@ -642,8 +630,8 @@ LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
return 0;
}
//
// We pass on all non-handled messages
//
/*
* We pass on all non-handled messages
*/
return CallWindowProc((WNDPROC)OldGraphCtrlWndProc, hWnd, message, wParam, lParam);
}

View file

@ -122,7 +122,7 @@ void PerfDataRefresh(void)
return;
/* Get processor time information */
//SysProcessorTimeInfo = new SYSTEM_PROCESSORTIME_INFO[SystemBasicInfo.bKeNumberProcessors];
/* SysProcessorTimeInfo = new SYSTEM_PROCESSORTIME_INFO[SystemBasicInfo.bKeNumberProcessors]; */
SysProcessorTimeInfo = (PSYSTEM_PROCESSORTIME_INFO)malloc(sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize);
if (status != NO_ERROR)
@ -136,13 +136,13 @@ void PerfDataRefresh(void)
do
{
BufferSize += 0x10000;
//SysHandleInfoData = new BYTE[BufferSize];
/* SysHandleInfoData = new BYTE[BufferSize]; */
SysHandleInfoData = (LPBYTE)malloc(BufferSize);
status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
//delete[] SysHandleInfoData;
/* delete[] SysHandleInfoData; */
free(SysHandleInfoData);
}
@ -156,13 +156,13 @@ void PerfDataRefresh(void)
do
{
BufferSize += 0x10000;
//pBuffer = new BYTE[BufferSize];
/* pBuffer = new BYTE[BufferSize]; */
pBuffer = (LPBYTE)malloc(BufferSize);
status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
//delete[] pBuffer;
/* delete[] pBuffer; */
free(pBuffer);
}
@ -184,7 +184,7 @@ void PerfDataRefresh(void)
* Save system processor time info
*/
if (SystemProcessorTimeInfo) {
//delete[] SystemProcessorTimeInfo;
/* delete[] SystemProcessorTimeInfo; */
free(SystemProcessorTimeInfo);
}
SystemProcessorTimeInfo = SysProcessorTimeInfo;
@ -193,7 +193,7 @@ void PerfDataRefresh(void)
* Save system handle info
*/
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
//delete[] SysHandleInfoData;
/* delete[] SysHandleInfoData; */
free(SysHandleInfoData);
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.bKeNumberProcessors; Idx++) {
@ -204,16 +204,16 @@ void PerfDataRefresh(void)
/* If it's a first call - skip idle time calcs */
if (liOldIdleTime.QuadPart != 0) {
// CurrentValue = NewValue - OldValue */
/* CurrentValue = NewValue - OldValue */
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
dbKernelTime = CurrentKernelTime - OldKernelTime;
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
// CurrentCpuIdle = IdleTime / SystemTime
/* CurrentCpuIdle = IdleTime / SystemTime */
dbIdleTime = dbIdleTime / dbSystemTime;
dbKernelTime = dbKernelTime / dbSystemTime;
// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
}
@ -239,11 +239,11 @@ void PerfDataRefresh(void)
/* Now alloc a new PERFDATA array and fill in the data */
if (pPerfDataOld) {
//delete[] pPerfDataOld;
/* delete[] pPerfDataOld; */
free(pPerfDataOld);
}
pPerfDataOld = pPerfData;
//pPerfData = new PERFDATA[ProcessCount];
/* pPerfData = new PERFDATA[ProcessCount]; */
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
for (Idx=0; Idx<ProcessCount; Idx++) {
@ -329,7 +329,7 @@ int MultiByteToWideChar(
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
}
//delete[] pBuffer;
/* delete[] pBuffer; */
free(pBuffer);
LeaveCriticalSection(&PerfDataCriticalSection);
}
@ -836,7 +836,7 @@ ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
LeaveCriticalSection(&PerfDataCriticalSection);
//SystemCache = SystemCache * (PageSize / 1024);
/* SystemCache = SystemCache * (PageSize / 1024); */
SystemCache = SystemCache / 1024;
return SystemCache;

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
@ -40,45 +40,36 @@
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
TGraphCtrl PerformancePageMemUsageHistoryGraph;
HWND hPerformancePage; // Performance Property Page
HWND hPerformancePageCpuUsageGraph; // CPU Usage Graph
HWND hPerformancePageMemUsageGraph; // MEM Usage Graph
HWND hPerformancePageCpuUsageHistoryGraph; // CPU Usage History Graph
HWND hPerformancePageMemUsageHistoryGraph; // Memory Usage History Graph
HWND hPerformancePageTotalsFrame; // Totals Frame
HWND hPerformancePageCommitChargeFrame; // Commit Charge Frame
HWND hPerformancePageKernelMemoryFrame; // Kernel Memory Frame
HWND hPerformancePagePhysicalMemoryFrame; // Physical Memory Frame
HWND hPerformancePage; /* Performance Property Page */
HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
HWND hPerformancePageTotalsFrame; /* Totals Frame */
HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
HWND hPerformancePageCpuUsageFrame;
HWND hPerformancePageMemUsageFrame;
HWND hPerformancePageCpuUsageHistoryFrame;
HWND hPerformancePageMemUsageHistoryFrame;
HWND hPerformancePageCommitChargeTotalEdit; // Commit Charge Total Edit Control
HWND hPerformancePageCommitChargeLimitEdit; // Commit Charge Limit Edit Control
HWND hPerformancePageCommitChargePeakEdit; // Commit Charge Peak Edit Control
HWND hPerformancePageKernelMemoryTotalEdit; // Kernel Memory Total Edit Control
HWND hPerformancePageKernelMemoryPagedEdit; // Kernel Memory Paged Edit Control
HWND hPerformancePageKernelMemoryNonPagedEdit; // Kernel Memory NonPaged Edit Control
HWND hPerformancePagePhysicalMemoryTotalEdit; // Physical Memory Total Edit Control
HWND hPerformancePagePhysicalMemoryAvailableEdit; // Physical Memory Available Edit Control
HWND hPerformancePagePhysicalMemorySystemCacheEdit; // Physical Memory System Cache Edit Control
HWND hPerformancePageTotalsHandleCountEdit; // Total Handles Edit Control
HWND hPerformancePageTotalsProcessCountEdit; // Total Processes Edit Control
HWND hPerformancePageTotalsThreadCountEdit; // Total Threads Edit Control
HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static HANDLE hPerformancePageEvent = NULL; // When this event becomes signaled then we refresh the performance page
static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
@ -133,23 +124,23 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
int nXDifference;
int nYDifference;
// HDC hdc;
// PAINTSTRUCT ps;
/* HDC hdc; */
/* PAINTSTRUCT ps; */
switch (message) {
case WM_INITDIALOG:
// Save the width and height
/* Save the width and height */
GetClientRect(hDlg, &rc);
nPerformancePageWidth = rc.right;
nPerformancePageHeight = rc.bottom;
// Update window position
/* Update window position */
SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
//
// Get handles to all the controls
//
/*
* Get handles to all the controls
*/
hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
@ -179,16 +170,16 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
// create the control
//PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
/* create the control */
/* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
// customize the control
/* customize the control */
GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10);
// PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ;
// PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ;
// PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ;
// PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ;
// PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ;
/* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */
/* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */
/* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */
/* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */
/* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */
GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ;
GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ;
GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ;
@ -200,14 +191,14 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ;
GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ;
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
// Start our refresh thread
/* Start our refresh thread */
#ifdef RUN_PERF_PAGE
CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
#endif
//
// Subclass graph buttons
//
/*
* Subclass graph buttons
*/
OldGraphWndProc = SetWindowLong(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
SetWindowLong(hPerformancePageMemUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
OldGraphCtrlWndProc = SetWindowLong(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (LONG)GraphCtrl_WndProc);
@ -246,7 +237,7 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
nPerformancePageHeight = cy;
} while (0);
// Reposition the performance page's controls
/* Reposition the performance page's controls */
AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
@ -315,8 +306,8 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
void RefreshPerformancePage(void)
{
// Signal the event so that our refresh thread
// will wake up and refresh the performance page
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
SetEvent(hPerformancePageEvent);
}
@ -340,10 +331,10 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
TCHAR Text[260];
// Create the event
/* Create the event */
hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Performance Page Event"));
// If we couldn't create the event then exit the thread
/* If we couldn't create the event then exit the thread */
if (!hPerformancePageEvent)
return 0;
@ -351,22 +342,22 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
{
DWORD dwWaitVal;
// Wait on the event
/* Wait on the event */
dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
// If the wait failed then the event object must have been
// closed and the task manager is exiting so exit this thread
/* If the wait failed then the event object must have been */
/* closed and the task manager is exiting so exit this thread */
if (dwWaitVal == WAIT_FAILED)
return 0;
if (dwWaitVal == WAIT_OBJECT_0)
{
// Reset our event
/* Reset our event */
ResetEvent(hPerformancePageEvent);
//
// Update the commit charge info
//
/*
* Update the commit charge info
*/
CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
@ -379,9 +370,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
wsprintf(Text, _T("Mem Usage: %dK / %dK"), CommitChargeTotal, CommitChargeLimit);
SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
//
// Update the kernel memory info
//
/*
* Update the kernel memory info
*/
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
@ -392,9 +383,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
_ultot(KernelMemoryNonPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
//
// Update the physical memory info
//
/*
* Update the physical memory info
*/
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
@ -405,9 +396,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
_ultot(PhysicalMemorySystemCache, Text, 10);
SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
//
// Update the totals info
//
/*
* Update the totals info
*/
TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
@ -418,13 +409,12 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
_ultot(TotalProcesses, Text, 10);
SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
//
// Redraw the graphs
//
/*
* Redraw the graphs
*/
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
//
ULONG CpuUsage;
ULONG CpuKernelUsage;
@ -435,9 +425,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
int nBarsUsed1;
int nBarsUsed2;
//
// Get the CPU usage
//
/*
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
if (CpuUsage < 0 ) CpuUsage = 0;
@ -445,9 +435,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
if (CpuKernelUsage < 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
//
// Get the memory usage
//
/*
* Get the memory usage
*/
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
@ -459,7 +449,7 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
//PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ;
/* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
}
@ -475,7 +465,7 @@ void PerformancePage_OnViewShowKernelTimes(void)
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
// Check or uncheck the show 16-bit tasks menu item
/* Check or uncheck the show 16-bit tasks menu item */
if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);

View file

@ -291,7 +291,7 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
#ifdef UNICODE
#define _ui64toa _ui64tow
#else
@ -302,35 +302,35 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
_ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
_ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
_ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
_ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
//wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
_ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}