¿Cómo debo prepararme para agregar un contador de rendimiento?

I am starting to build caching mechanism, in the feature I will want to add a support for performance counter, so the question is how can I plan for a head for this support inorder I will need to modify little code as possible when I am entering this feature

Sine it my first time using this feature, I think I need now(before creating the cache mechanism) to create simple program in order to understand how can I prepare for it..

If I will try to guess for advance what I need to measure, it will help me in the in feature when I will implement it?

Do you have any another suggestion how should I prepare to add this feature?

Is there any known alternative to performance counter?

Gracias.

preguntado el 09 de enero de 11 a las 11:01

2 Respuestas

Opening and updating a performance counter is very easy, only a few statements are needed. But you do need to consider what measures you will report and will this be a counter object with one or multiple instances. And you will need an installer (performance counters need to be registered).

First consider the measures you will report on. Things like cache use rate, items in cache and cache hit ratio are obvious. But is there anything else that will help administer your application? If you can talk to the people who will administer and support the application then do so—they are likely to have their own ideas about what is useful.

Expect to learn in real use what are the useful counters!

If there will be a single instance of your cache on a single system then multiple-instance counters do not make sense, but if you need instances then you need to think how the instances will be named.

Finally, worth looking at the options available for counter types and what they mean—the performance counter system will do some work for you (like calculating deltas and rates of individual counters and totals across instances).

Respondido el 09 de enero de 11 a las 15:01

It depends on the complexity of your performance measuring. If it's simple and only required at few places, use compiler switches or similar stuff. For complicated and mor sustainable scenarios I have tried two possibilities:

  1. You could go with one of the AOP frameworks, such as PostSharp. Might be an overkill though, the advantage is that you don't have to prepare your code in any way, you just add appropriate performance counting "aspect" at appropriate positions.

  2. You could consider an architecture for your application which is per se configurable, i.e. consists of loose components which communicate by sending and receiving "messages". In such architectures, components do not know each other they just know a reception/sending points from/to they receive/send messages. Then, it is easy to "insert" properly configured performance counting components at arbitrary positions in an component network.

Aclamaciones,

paul

Respondido el 09 de enero de 11 a las 15:01

I think I will use the compiler switches as you recommended :) - Delashmate

Yeah, sufficient in many cases. The above alternatives pay off for more complex frameworks with many components with different performance measuring scenarios.. - Paul Michalik

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.