|
You last visited: Today at 06:48
Advertisement
HELP - C++ Cpu Usage %100 Problem.
Discussion on HELP - C++ Cpu Usage %100 Problem. within the C/C++ forum part of the Coders Den category.
08/22/2013, 22:48
|
#1
|
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
|
[SOLVED]HELP - C++ Cpu Usage %100 Problem.
#Solved thanks to helps
|
|
|
08/22/2013, 23:26
|
#2
|
elite*gold: 0
Join Date: Aug 2012
Posts: 236
Received Thanks: 94
|
Just a question, why not #include <thread> and #include <thread> and then use std::thread and std::this_thread::sleep_for or std::this_thread::sleep_until with std::chrono::seconds (1)?
I cannot reproduce that behavior. The reason is somewhere else. Maybe in //Somethings?
|
|
|
08/22/2013, 23:31
|
#3
|
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
|
Quote:
Originally Posted by Tasiro
Just a question, why not #include <thread> and #include <thread> and then use std::thread and std::this_thread::sleep_for or std::this_thread::sleep_until with std::chrono::seconds (1)?
I cannot reproduce that behavior. The reason is somewhere else. Maybe in //Somethings?
|
Somethings example: a += 1;
|
|
|
08/22/2013, 23:39
|
#4
|
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
|
What happens if you leave "something" out?
|
|
|
08/22/2013, 23:44
|
#5
|
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
|
Quote:
Originally Posted by qkuh
What happens if you leave "something" out?
|
Again problem
|
|
|
08/22/2013, 23:49
|
#6
|
elite*gold: 0
Join Date: Feb 2013
Posts: 1,137
Received Thanks: 869
|
Show your whole code.
|
|
|
08/22/2013, 23:54
|
#7
|
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
|
Quote:
Originally Posted by Schlüsselbein
Show your whole code.
|
Example Full Code:
PHP Code:
#include <windows.h> #include <tlhelp32.h> #include <shlwapi.h> #include <tchar.h> #include <conio.h> #include <stdio.h> #include <Windows.h>
#include <stdio.h> #include <cstdlib> #include <iostream> #include <time.h> #include <tlhelp32.h> #include <string> #include <string.h> #include <iostream> #include <windows.h> #include <stdlib.h> #include <cstdlib> #include <string> #include <Shellapi.h> #include <windows.h> #include <string.h> #include <string> #include <time.h> #include <iostream> #include <iostream> using namespace std; #include <fstream> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/stat.h> #include <windows.h> #include <tlhelp32.h> #include <sys/stat.h> #pragma comment (lib, "user32.lib")
int val = 0; void mythread(){ while(1){ val += 1; If(val = 10000){ exit(0); } Sleep(1000); } } void mythread2(){ while(1){ int val; ReadProcessMemory(GetCurrentProcess(),(LPVOID)0x513612,&val,sizeof(val),NULL); If(val > 500){ exit(0); } Sleep(50); } }
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)mythread2, NULL, NULL, NULL); CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)mythread, NULL, NULL, NULL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
|
|
|
08/23/2013, 00:00
|
#8
|
elite*gold: 58
Join Date: Jun 2008
Posts: 2,311
Received Thanks: 8,420
|
That's possibly the worst code i've seen in a while. That doesn't even compile, I don't know what you are trying to achieve with this code..
Shouldn't you learn the basics first?
Padmak
|
|
|
08/23/2013, 00:02
|
#9
|
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
|
Quote:
Originally Posted by Padmak
That's possibly the worst code i've seen in a while. That doesn't even compile, I don't know what you are trying to achieve with this code..
Shouldn't you learn the basics first?
Padmak
|
Thx padmak.
But I making hacks & programs old 6 month but I have cpu problem
I need alternative.
Solved! I use timer
|
|
|
|
Similar Threads
|
Cpu Usage Problem
04/29/2013 - CO2 Private Server - 17 Replies
I have Problem My Cpu Usage take alot i have 6 Cpu and take 91%
http://www10.0zz0.com/2013/04/28/12/915185706.jpg
Mysqld it's only take all usage
http://www10.0zz0.com/2013/04/28/12/261488443.jpg
|
[PROBLEM] CPU usage 80% or even more while playing
08/15/2012 - Archlord - 8 Replies
Hi guys, since today i've started to have this problem with my PC, i don't know if this is normal while playing AL or if i'm being paranoic, or if my procesator have any kind of problem.
I have an Intel Core 2 duo E7300 and 3gb Memory ram, while i'm playing AL (With 1 account) i see that my Memory ram total usage is around 40%/50% that's normal, but when i see Procesator total usage, it stay in 60%, 70% and sometimes it goes to 100%.
This is normal or while playing AL?, thanks in advance.
|
[Problem]Excessive Item Usage
07/28/2011 - Flyff Private Server - 0 Replies
hat sich geklärt funz jetzt alles!
mfg NiGHT
|
CPU usage 80% when i am looking at SRO
01/13/2011 - Silkroad Online - 31 Replies
What i mean is when i alt tab to SRO , i get 80% cpu usage, if i alt tab out to other window (no longer looking at sro) i get 5% cpu usage...
I got a Core2Duo 2.66ghz, should be able to run this shit fine (only 1 client)
|
[Help]Ram Usage
09/28/2010 - CO2 Private Server - 18 Replies
Hey guys...I don't know if anything like this have happened to you too but the source is eating up RAM slowly...I was wondering if all of this happens because of the timers (that repeat every .1 second) if so ... I have a lot of "if's" in them checking the servertime...would it reduce the ram usage by using a switch (Servertime.hr/day/blahblah) and make with cases?
if this is not the problem of the ram usage can anybody tell me what causes this ram usage?
EDIT: i'm talking about tanel's...
|
All times are GMT +2. The time now is 06:48.
|
|