Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion about COM Monikers and the ROT Pin
[James Pullicino]26-Sep-02 3:39
[James Pullicino]26-Sep-02 3:39 
GeneralRe: Question about COM Monikers and the ROT Pin
jmkhael26-Sep-02 4:54
jmkhael26-Sep-02 4:54 
GeneralThreads in Windows 2000 Pin
Anonymous26-Sep-02 3:15
Anonymous26-Sep-02 3:15 
GeneralRe: Threads in Windows 2000 Pin
Tomasz Sowinski26-Sep-02 3:22
Tomasz Sowinski26-Sep-02 3:22 
GeneralRe: Threads in Windows 2000 Pin
Andreas Saurwein26-Sep-02 3:19
Andreas Saurwein26-Sep-02 3:19 
GeneralRe: Threads in Windows 2000 Pin
Mike Nordell26-Sep-02 11:49
Mike Nordell26-Sep-02 11:49 
GeneralRe: Threads in Windows 2000 Pin
Anonymous26-Sep-02 4:45
Anonymous26-Sep-02 4:45 
GeneralRe: Threads in Windows 2000 Pin
Todd Smith26-Sep-02 11:19
Todd Smith26-Sep-02 11:19 
Out of curiosity I ran a test which created 5k threads which incremented a global counter and then slept for 1000ms. In my main loop I reset the saved the global counter, set it to 0 and then slept for 1000ms.

I have a dual 1.2Ghz with 512mb of ram and I got an average of 2k counts per second.

CThread is my own custom thread class which calls Run in a while loop.

class CMyThread : public CThread
{
public:
	CMyThread() {}
	
	int Run()
	{
		g_Count++;

		Sleep(1000);
		
		return 1;
	}
};

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	#define numThreads 5000

	CMyThread* pThread[numThreads];;

	for (int i = 0; i < numThreads; i++)
	{
		pThread[i] = new CMyThread;
		bool bStart = pThread[i]->StartThread();
	}
	
	#define numLoops 60

	int count = 0;
	int total = 0;


	for (int j = 0; j < numLoops; j++)
	{
		g_Count = 0;

		Sleep(1000);

		total += g_Count;
	}

	float avg = total / numLoops;

	return 0;
}


Todd Smith
GeneralDialog Box Pin
Lucky200226-Sep-02 3:01
Lucky200226-Sep-02 3:01 
GeneralRe: Dialog Box Pin
Roman Fadeyev26-Sep-02 3:09
Roman Fadeyev26-Sep-02 3:09 
GeneralRe: Dialog Box Pin
Lucky200226-Sep-02 3:11
Lucky200226-Sep-02 3:11 
GeneralRe: Dialog Box Pin
Roman Fadeyev26-Sep-02 3:26
Roman Fadeyev26-Sep-02 3:26 
GeneralRe: Dialog Box Pin
Tomasz Sowinski26-Sep-02 3:25
Tomasz Sowinski26-Sep-02 3:25 
GeneralRe: Dialog Box Pin
Lucky200226-Sep-02 3:25
Lucky200226-Sep-02 3:25 
GeneralRe: Dialog Box Pin
Tomasz Sowinski26-Sep-02 3:32
Tomasz Sowinski26-Sep-02 3:32 
GeneralRe: Dialog Box Pin
Lucky200226-Sep-02 4:01
Lucky200226-Sep-02 4:01 
GeneralRe: Dialog Box Pin
Tomasz Sowinski26-Sep-02 4:19
Tomasz Sowinski26-Sep-02 4:19 
GeneralRe: Dialog Box Pin
Lucky200226-Sep-02 4:10
Lucky200226-Sep-02 4:10 
GeneralRe: Dialog Box Pin
Tomasz Sowinski26-Sep-02 4:23
Tomasz Sowinski26-Sep-02 4:23 
GeneralRe: Dialog Box Pin
Lucky200226-Sep-02 4:26
Lucky200226-Sep-02 4:26 
GeneralRe: Dialog Box Pin
Nitron26-Sep-02 3:42
Nitron26-Sep-02 3:42 
QuestionIs that a focus problem? Pin
chen26-Sep-02 2:58
chen26-Sep-02 2:58 
Questionhow to build a multilingual application? Pin
Rene De La Garza26-Sep-02 2:57
Rene De La Garza26-Sep-02 2:57 
AnswerRe: how to build a multilingual application? Pin
Tomasz Sowinski26-Sep-02 3:04
Tomasz Sowinski26-Sep-02 3:04 
GeneralRe: how to build a multilingual application? Pin
Rene De La Garza26-Sep-02 10:10
Rene De La Garza26-Sep-02 10:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.