2

I'm facing a tricky problem and I hope you guys will be able to help!

An application I'm working on is getting slow at some point of its lifetime and I suspect it's related to incoming events.

In order to clarify this behavior and know if it's the actual source of my nightmares, I would like to trace the event stack size.

So do you guys know a way to know how many events are queued, waiting to be processed by the event handler of my application?

Is it possible to change this value ? Does my question make any sense?

Thanks in advance!

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Andy M
  • 5,945
  • 7
  • 51
  • 96
  • It's the core of an application that is designed to be launched from as console app, winforms app or simple a service. In my case, it's started from as a console app. – Andy M May 30 '11 at 14:09
  • What is the source of your events? Do they come from the same thread? from another thread? from another process? from the hardware? from user interaction? from the web? I think that this is a very important factor in your case. – Murven May 30 '11 at 14:16
  • I receive lots of event from an external application (on the same computer). To treat this event, we start a chain of 7 events travelling through our application that finally starts a thread. I suspect that all those events, after being thrown, stack up and fill completely the events stack, causing the whole application to slow up badly ! In worst case, it's totally possible to receive many hundreds of even from the external application each seconds ! – Andy M May 30 '11 at 14:23

2 Answers2

2

I know this is not a direct answer to your question but i usually do my performance tuning with the help of profiling software. For .NET i can recommend jetbrains dotTrace but i'm sure you'll find one in this SO question.

Community
  • 1
  • 1
Till
  • 3,084
  • 17
  • 18
1

This might depend on what kind of event you're handling. I guess that events in winform enviroments have a good part of overhead but that might not be the problem.

Another setup is to simply let all events 'post' a workitem into a list and let the 'worker' threads empty the work list. This lets you see the workitem list and gives you some control/directions to optimize the code.

CodingBarfield
  • 3,392
  • 2
  • 27
  • 54