The C++ framework for developing highly scalable, high performance servers on Windows platforms.

Example Servers - Echo Server Service Perf

This example shows you how to build a simple server service that exposes performance counters. The basic structure of the TCP server is similar to the Echo Server Service example and the performance counter integration is detailed in the Echo Server Perf example. You should go and read about those first and have a good understanding of how everything fits together. This document will only cover the differences between those examples and this one.

This example requires the "Windows Services" AND the "Performance Counters" licensing options of The Server Framework and it requires libraries that only ship with those options (see here for licensing options). You can always download the latest version of this example from here; and although you will need the correct libraries to be able to build it you can look at the example code and see how it works and perhaps get ideas from it. A compiled, unicode release, build of this example is available on request if you require it for performance analysis of the framework.

The most important detail of this server is how it integrates the registration and removal of the performance counters into the CService object so that the build in command line registration options provided by the Service Tools Library work correctly. The integration should be done as follows:

 bool CService::OnInstallCounters()
 {
    const bool ok = CPerformanceCounters::InstallCounters();

    if (ok)
    {
       OutputEx(_T("Performance counters installed"));
    }
    else
    {
       OutputEx(_T("Performance counters are already installed"));
    }

    return ok;
 }

 bool CService::OnRemoveCounters()
 {
    const bool ok = CPerformanceCounters::RemoveCounters();

    if (ok)
    {
       OutputEx(_T("Performance counters removed"));
    }
    else
    {
       OutputEx(_T("Performance counters are not installed, so cannot be removed"));
    }

    return ok;
 }

Everything else about the example is pretty much as is explained in the two examples that this is based on.

Generated on Sun Sep 12 19:06:45 2021 for The Server Framework - v7.4 by doxygen 1.5.3