Hi Group,
I've been working on an application that reads data from a comm port and 1)
writes the data to file, 2) displays this data in three different graphs in
real time.The port is receiving data at 38400 baud, the plan is that it will
go up to 115k baud. My app works fine on my development pc (P4 2.6G), But
when the application runs on a pc that is slower (Like a p3 laptop that is
used when on the road) it freezes. The laptop cant handle all of the
calculations used in the Graphing objects. I now this because if I disable
one of my graphs (a multi channel line graph), cpu usage goes from 75% down
to 34%(as per task manager). So I know *which* object is giving me
problems.
My boss wants me to be able to monitor when the pc starts to lagg. If it
laggs, I'm to continue logging the data to file, but not graph every line
that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code) if my
computer is starting to lagg, or if my cpu usage is too high or something
like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help
what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco 7 2293
What exactly do you mean with "it freezes"?
If the CPU usage is only 75%, it's certainly not the cause of the lagg.
I would suggest:
- you profile your application and watch excessive function execution times.
- if it's a multithreaded application (which I hope it is) , watch for lock
contention.
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:db*******************@news20.bellglobal.com.. . Hi Group,
I've been working on an application that reads data from a comm port and
1) writes the data to file, 2) displays this data in three different graphs
in real time.The port is receiving data at 38400 baud, the plan is that it
will go up to 115k baud. My app works fine on my development pc (P4 2.6G), But when the application runs on a pc that is slower (Like a p3 laptop that is used when on the road) it freezes. The laptop cant handle all of the calculations used in the Graphing objects. I now this because if I
disable one of my graphs (a multi channel line graph), cpu usage goes from 75%
down to 34%(as per task manager). So I know *which* object is giving me problems.
My boss wants me to be able to monitor when the pc starts to lagg. If it laggs, I'm to continue logging the data to file, but not graph every line that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code) if my computer is starting to lagg, or if my cpu usage is too high or something like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco
Use the System.Diagnostics.PerformanceCounter:
PerformanceCounter pc = new PerformanceCounter("Processor", "% Processor
Time", "_Total");
....
....
pc.NextValue() // gets the cpu % . sometimes the first call will be 0,
other calls will be correct. be aware
....
So (strictly psuedocode)
PerformanceCounter pc = new PerformanceCounter("Processor", "% Processor
Time", "_Total");
single cpu = pc.NextValue();
while (gettingData())
{
if(cpu < 75)
{ renderLine(); }
cpu = pc.NextValue();
}
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:db*******************@news20.bellglobal.com.. . Hi Group,
I've been working on an application that reads data from a comm port and
1) writes the data to file, 2) displays this data in three different graphs
in real time.The port is receiving data at 38400 baud, the plan is that it
will go up to 115k baud. My app works fine on my development pc (P4 2.6G), But when the application runs on a pc that is slower (Like a p3 laptop that is used when on the road) it freezes. The laptop cant handle all of the calculations used in the Graphing objects. I now this because if I
disable one of my graphs (a multi channel line graph), cpu usage goes from 75%
down to 34%(as per task manager). So I know *which* object is giving me problems.
My boss wants me to be able to monitor when the pc starts to lagg. If it laggs, I'm to continue logging the data to file, but not graph every line that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code) if my computer is starting to lagg, or if my cpu usage is too high or something like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco
Willy,
Thanks for your reply. The app is multi-threaded.
Basically, when start button is clicked, I create a thread that reads lines
from the comm port inside an infinite loop(which is in an unsafe class
instance). When a line is read, it fires a "CommEvent" in main thread.
When the comm event is fired I do a bunch of UI updates and then start a new
thread that updates all of the graphs.
I had decided to update the graphs in their own thread because of the
intensive calculations needed in order to plot properly.
What I mean by freezes is that the UI starts to get gittery and that
eventualy, nothing happens any more. At this point, task manager shows me
100% CPU usage.
regards,
Marco
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl... What exactly do you mean with "it freezes"?
If the CPU usage is only 75%, it's certainly not the cause of the lagg. I would suggest: - you profile your application and watch excessive function execution
times. - if it's a multithreaded application (which I hope it is) , watch for
lock contention.
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message news:db*******************@news20.bellglobal.com.. . Hi Group,
I've been working on an application that reads data from a comm port and 1) writes the data to file, 2) displays this data in three different graphs in real time.The port is receiving data at 38400 baud, the plan is that it will go up to 115k baud. My app works fine on my development pc (P4 2.6G),
But when the application runs on a pc that is slower (Like a p3 laptop that
is used when on the road) it freezes. The laptop cant handle all of the calculations used in the Graphing objects. I now this because if I disable one of my graphs (a multi channel line graph), cpu usage goes from 75% down to 34%(as per task manager). So I know *which* object is giving me problems.
My boss wants me to be able to monitor when the pc starts to lagg. If
it laggs, I'm to continue logging the data to file, but not graph every
line that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code) if
my computer is starting to lagg, or if my cpu usage is too high or
something like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco
Thanks,
With the PerformanceCounter, I am able to check if it's possible to update
the graph.
Best regards,
Marco
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:db*******************@news20.bellglobal.com.. . Hi Group,
I've been working on an application that reads data from a comm port and
1) writes the data to file, 2) displays this data in three different graphs
in real time.The port is receiving data at 38400 baud, the plan is that it
will go up to 115k baud. My app works fine on my development pc (P4 2.6G), But when the application runs on a pc that is slower (Like a p3 laptop that is used when on the road) it freezes. The laptop cant handle all of the calculations used in the Graphing objects. I now this because if I
disable one of my graphs (a multi channel line graph), cpu usage goes from 75%
down to 34%(as per task manager). So I know *which* object is giving me problems.
My boss wants me to be able to monitor when the pc starts to lagg. If it laggs, I'm to continue logging the data to file, but not graph every line that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code) if my computer is starting to lagg, or if my cpu usage is too high or something like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco
Marco,
When the "graphs" are UI elements created on the main UI thread, you should
NEVER EVER update these objects from any other thread as the main UI thread
(the creator of the UI elements).
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:l2*******************@news20.bellglobal.com.. . Willy, Thanks for your reply. The app is multi-threaded.
Basically, when start button is clicked, I create a thread that reads
lines from the comm port inside an infinite loop(which is in an unsafe class instance). When a line is read, it fires a "CommEvent" in main thread. When the comm event is fired I do a bunch of UI updates and then start a
new thread that updates all of the graphs. I had decided to update the graphs in their own thread because of the intensive calculations needed in order to plot properly.
What I mean by freezes is that the UI starts to get gittery and that eventualy, nothing happens any more. At this point, task manager shows me 100% CPU usage.
regards,
Marco
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eh**************@TK2MSFTNGP09.phx.gbl... What exactly do you mean with "it freezes"?
If the CPU usage is only 75%, it's certainly not the cause of the lagg. I would suggest: - you profile your application and watch excessive function execution times. - if it's a multithreaded application (which I hope it is) , watch for lock contention.
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message news:db*******************@news20.bellglobal.com.. . Hi Group,
I've been working on an application that reads data from a comm port
and 1) writes the data to file, 2) displays this data in three different
graphs in real time.The port is receiving data at 38400 baud, the plan is that
it will go up to 115k baud. My app works fine on my development pc (P4 2.6G), But when the application runs on a pc that is slower (Like a p3 laptop
that is used when on the road) it freezes. The laptop cant handle all of the calculations used in the Graphing objects. I now this because if I disable one of my graphs (a multi channel line graph), cpu usage goes from 75% down to 34%(as per task manager). So I know *which* object is giving me problems.
My boss wants me to be able to monitor when the pc starts to lagg. If it laggs, I'm to continue logging the data to file, but not graph every line that comes in. I should only graph every second or third line...
So to make my story short, how can I go about knowing (through code)
if my computer is starting to lagg, or if my cpu usage is too high or something like that. I'm not even sure where to start looking...
I've only got a few days to come up with a solution so *any* help what-so-ever would be greatly appreciated.
Thanks and best regards,
Marco
thanks Willy, When the "graphs" are UI elements created on the main UI thread, you should NEVER EVER update these objects from any other thread as the main UI
thread
Can I ask you why?
Marco
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uo**************@tk2msftngp13.phx.gbl... Marco,
When the "graphs" are UI elements created on the main UI thread, you
should NEVER EVER update these objects from any other thread as the main UI
thread (the creator of the UI elements).
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message news:l2*******************@news20.bellglobal.com.. . Willy, Thanks for your reply. The app is multi-threaded.
Basically, when start button is clicked, I create a thread that reads lines from the comm port inside an infinite loop(which is in an unsafe class instance). When a line is read, it fires a "CommEvent" in main thread. When the comm event is fired I do a bunch of UI updates and then start a new thread that updates all of the graphs. I had decided to update the graphs in their own thread because of the intensive calculations needed in order to plot properly.
What I mean by freezes is that the UI starts to get gittery and that eventualy, nothing happens any more. At this point, task manager shows
me 100% CPU usage.
regards,
Marco
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eh**************@TK2MSFTNGP09.phx.gbl... What exactly do you mean with "it freezes"?
If the CPU usage is only 75%, it's certainly not the cause of the
lagg. I would suggest: - you profile your application and watch excessive function execution times. - if it's a multithreaded application (which I hope it is) , watch for lock contention.
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message news:db*******************@news20.bellglobal.com.. . > Hi Group, > > I've been working on an application that reads data from a comm port and 1) > writes the data to file, 2) displays this data in three different graphs in > real time.The port is receiving data at 38400 baud, the plan is that it will > go up to 115k baud. My app works fine on my development pc (P4
2.6G), But > when the application runs on a pc that is slower (Like a p3 laptop that is > used when on the road) it freezes. The laptop cant handle all of
the > calculations used in the Graphing objects. I now this because if I disable > one of my graphs (a multi channel line graph), cpu usage goes from
75% down > to 34%(as per task manager). So I know *which* object is giving me > problems. > > My boss wants me to be able to monitor when the pc starts to lagg.
If it > laggs, I'm to continue logging the data to file, but not graph every line > that comes in. I should only graph every second or third line... > > So to make my story short, how can I go about knowing (through code) if my > computer is starting to lagg, or if my cpu usage is too high or something > like that. I'm not even sure where to start looking... > > I've only got a few days to come up with a solution so *any* help > what-so-ever would be greatly appreciated. > > Thanks and best regards, > > Marco > > > > >
Sure I can, but [1] does it much better ;-)
Read it carefully I guess it will help you solve your issue.
[1]< http://msdn.microsoft.com/msdnmag/is...ing/default.as
px>
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:hp********************@news20.bellglobal.com. .. thanks Willy,
When the "graphs" are UI elements created on the main UI thread, you
should NEVER EVER update these objects from any other thread as the main UI thread
Can I ask you why?
Marco "Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:uo**************@tk2msftngp13.phx.gbl... Marco,
When the "graphs" are UI elements created on the main UI thread, you should NEVER EVER update these objects from any other thread as the main UI thread (the creator of the UI elements).
Willy.
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message news:l2*******************@news20.bellglobal.com.. . Willy, Thanks for your reply. The app is multi-threaded.
Basically, when start button is clicked, I create a thread that reads lines from the comm port inside an infinite loop(which is in an unsafe class instance). When a line is read, it fires a "CommEvent" in main
thread. When the comm event is fired I do a bunch of UI updates and then start
a new thread that updates all of the graphs. I had decided to update the graphs in their own thread because of the intensive calculations needed in order to plot properly.
What I mean by freezes is that the UI starts to get gittery and that eventualy, nothing happens any more. At this point, task manager
shows me 100% CPU usage.
regards,
Marco
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eh**************@TK2MSFTNGP09.phx.gbl... > What exactly do you mean with "it freezes"? > > If the CPU usage is only 75%, it's certainly not the cause of the lagg. > I would suggest: > - you profile your application and watch excessive function
execution times. > - if it's a multithreaded application (which I hope it is) , watch
for lock > contention. > > Willy. > > > "Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message > news:db*******************@news20.bellglobal.com.. . > > Hi Group, > > > > I've been working on an application that reads data from a comm
port and > 1) > > writes the data to file, 2) displays this data in three different graphs > in > > real time.The port is receiving data at 38400 baud, the plan is
that it > will > > go up to 115k baud. My app works fine on my development pc (P4 2.6G), But > > when the application runs on a pc that is slower (Like a p3 laptop that is > > used when on the road) it freezes. The laptop cant handle all of the > > calculations used in the Graphing objects. I now this because if
I > disable > > one of my graphs (a multi channel line graph), cpu usage goes from
75% > down > > to 34%(as per task manager). So I know *which* object is giving
me > > problems. > > > > My boss wants me to be able to monitor when the pc starts to lagg. If it > > laggs, I'm to continue logging the data to file, but not graph
every line > > that comes in. I should only graph every second or third line... > > > > So to make my story short, how can I go about knowing (through
code) if my > > computer is starting to lagg, or if my cpu usage is too high or something > > like that. I'm not even sure where to start looking... > > > > I've only got a few days to come up with a solution so *any* help > > what-so-ever would be greatly appreciated. > > > > Thanks and best regards, > > > > Marco > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: christopher diggins |
last post by:
I would like to survey how widespread the usage of smart pointers in C++
code is today. Any anecdotal experience about the frequency of usage of
smart pointer for dynamic allocation in your own...
|
by: w2jin |
last post by:
Hi All
Some my SQL Server are experience high memory usage.
1. How can I detect which process which process cause the big memory
usage and not released?
2. Which sql server components in...
|
by: rdemyan via AccessMonster.com |
last post by:
My app contains utility meter usage. One of the things we have to deal with
is when a usage is clearly incorrect. Perhaps someone wrote the meter
reading down incorrectly or made a factor of 10...
|
by: Adam Right |
last post by:
Hi,
Anyone suffers from the high memory usage of C# in windows applications? Is
there a solution for that problem? Thanks...
|
by: Dinesh |
last post by:
Hi,
We are seeing high memory usage (1GB) and subsequently out of memory
exception.
We are trying to transform the documents using xslt and most importantly
using Assembly.Evidence to avoid...
|
by: |
last post by:
weve installed our asp.net 11. (32 bit) web app on windows 2002 64 bit
server running under 32 bit emulation mode.
should work ok, but were seeing cpu at 100%, but the server is a qaud dual
core...
|
by: Mechul |
last post by:
Hi people i need serious help here..
I have a forum and my hosting company suspended it cuz of the high usage of sql.
We did everything to make lower the usage but its still high.
it was
...
|
by: Learning.Net |
last post by:
I have a window application that uses ActiveX browser component for
testing web site automatically using mshtml.
Though application is running fine but there is abnormally high page
file usage....
|
by: santhescript01 |
last post by:
I have a window application that uses ActiveX browser component for testing web site automatically using mshtml.
Though application is running fine but there is abnormally high page file usage....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |