 |
|
|
Baseing on the source code provided in here, I created a dll as a Native Library in Java so that I could get the CPU usage at the moment of the servlet executing. Initially, everything is fine. However, when I carried out the stress test (about 30 concurrent users), the Websphere 5.1.14 would be hang and restarted automatically after a period of time (e.g. 1 hr). I find that there was an error event in the Windows event log. The message was about "Faulting application java.exe, version 142.2004.6.26, faulting module CheckCPU.dll, version 0.0.0.0, fault address 0x00003111"
I really have no idea about it, may anyone kindly give me advice?
Thanks a lot.
P.S. The websphere is running in Windows 2003 SP1
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
how can i calculate the cpu usage of a dll when the computer has more then one cores (4)?
|
| Sign In·View Thread·PermaLink | 1.67/5 (3 votes) |
|
|
|
 |
|
|
Hi,
I'm using Vista Ultimate 64-bit, and your application displays my CPU being busy by around 387%, which doesn't look right... ))
My CPU Intel Core Quadro.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Can I make use of same code for WinPE bootable systems?I am using WinXP image for WinPE boot.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Great sample, but why wouldn't you refactor GetCpuUsage(DWORD dwProcessID) and GetCpuUsage(DWORD dwProcessID)? At least have one call the other...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, thanks for the code. It works under ISAPI if running on XP but not on Win 2003 server. I'm calling it througn process id.
The following line returns 0 every time. But works fine under XP! Any suggestions? Thank you.
lnNewValue = PerfCounters.GetCounterValueForProcessID(&pPerfData, dwObjectIndex, dwCpuUsageIndex, dwProcessID);
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
hi! thank you for your codes.
now, i am using your code in my program, but i wonder how can i get the counter index to get value. ( such as user time, kernel time of cpu..)
i was trying to find the secret of indexes, but failed...  can you show me the way to find the indexes or the indexing list of counters?
user time, kernel time... it's neccessary to my program...
thank you for your help, in advance!!
-- i agree.. BUT!! --
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I have a strange bug. Your code works great, but after inserting at a big project it starts to always return 100% about full cpu usage. Any ideas? -___-
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
I don't think so. It works for me in XP but does not work in Vista. For Vista see http://msdn2.microsoft.com/en-us/library/aa394317(printer).aspx? I have not tried to implement the new stuff but will soon have to...
Howard C. Anderson HTTP://www.astroshow.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
hi friends!
is there any libray or header available in turbo c++ compiler to get the CPU usage, system perfomance monitor etc., ?
kindly reply me soon
thanks in advance
AK
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Ok i`m starting to think i may be retarded since i tried everything to get this wonderful code to work correctly on my XP box. I read all the previous messages and STILL can't get it to work. it always shows 100%.
However the original, unmodified sample project i downloaded here is dead right on the CPU load.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
If my sample works good on your xp then send me by mail your code dudiav@hotmail.com so i can take a look.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Well that is the funny thing ... it`s your original code, those exact files(appart from adding a T()) made as a new project in VS2005. But your code _converted_ to VS2005 works just fine. *boggles*
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
For some reason, this project won't compile under Visual C++ 2005 (Express). It doesn't find the atlbase.h / atldef.h and when I include them (from the latest Microsoft SDK), even if I copy the files to Visual C++'s include folder, it doesn't recognize it. And when it does, it gives me another error:
Project : error PRJ0003 : Error spawning 'midl.exe'.
What could I do?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
how did u solved the midl.exe error, i am stuck here. I'm trying to create a dll and it displays the error as below.
Project : error PRJ0003 : Error spawning 'midl.exe'.
Please guide me,
thanks in advance
madhav_sigdel
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I make a thread. then i use a CpuUsage. but CpuUsage Only return 0.
what is problem?
//------------------------------------ // source //------------------------------------ void CpuCheckThread::run() { while(true) { if(m_bStop == true) { break; }
int mc = m_cpuage.GetCpuUsage("Test"); // mc = 0 (only) int system = m_cpuage.GetCpuUsage(); // system = 0 (only)
Sleep(10); } }
//------------------------------------ // environment //------------------------------------ Cpu : Pentium(R) 4, 3.2GHz (Dual) Ram : 1.00GB RAM IDE : Visual C++ 7.0
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
I really like the code but sometimes I get back a result of greater than 100. The funny thing is that I never get back a value greater than 100 when using the sample project. Every time I run my project with your sample project my project returns values greater than 100 and your project never does? This is so weird. I made sure I have the exact CpuUsage.cpp, CpuUsage.h, and PerfCounters.h. Then only thing different is that I have to include Winperf.h in my stdAfx.h file to compile my project. Do you have any suggestions? Right now every time I get back a value greater than 100 I reset it to be 0.
Chris
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
I have no idea. But you can remove calling winperf.h from stdafx.h if you comment out the VC_EXTRALEAN for MFC use or WIN32_LEAN_AND_MEAN (from stdafx.h) which excludes rarely-used stuff from Windows headers.
|
| Sign In·View Thread·PermaLink | 2.50/5 (2 votes) |
|
|
|
 |
|
|
I believe the > 100% error has to do with the fact that you have either a hyper-threaded or multi-core processor. It appears by default the author has chosen the idle process as his example when getting performance counters for ProcessID. I suspect the System Idle process is somewhat unique in that it is being executed on all cores simultaneously. Therefore the only way to get an accurate % on a multicore / hyper threaded processor is to do the following:
double a = (double)lnValueDelta / DeltaPerfTime100nSec; SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); CpuUsage = (int)( (a*(double)100) / (double)sysinfo.dwNumberOfProcessors) ;
This is mostly relevant to the Idle process, but could be relevant to all processes from the standpoint if you have a dual core processor and one process is utilizing 50% of 1 core, you really are utilizing 25% of your available resources on the machine.
On a sidenote BiShopx's comments are what made me come to this conclusion. I'd guess a quad core would report 400% for the idle process.
Nice piece of code!
Dave
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |