[Previous] [Contents] [Index] [Next]

PfGetCacheStats()

Get statistics about font-manager glyph caches

Synopsis:

long PfGetCacheStats( FontStats *ptsStats,
                      unsigned long ulFlags);

Arguments:

ptsStats
A pointer to a FontStats structure containing at least the following members:
ulFlags
An exclusive flag that determines for which glyph cache to retrieve statistical information:

Library:

ph

Description:

This function retrieves the current statistics relating to the number of hits/attempts of the respective font-manager glyph caches.

Returns:

0L
Success.
-1L
An error occurred; errno is set.

Errors:

EINVAL
An unknown flag type was requested.
ENOTSUP
The statistics requested couldn't be provided by this particular font server.
EFAULT
The necessary parameters were NULL.

Examples:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Ap.h>
#include <Ph.h>
#include <Pt.h>
#include <errno.h>

int main(int argc, char *argv[])
{   double Percentage;
    FontStats tsStat;

    PtInit (NULL);

    if(PfGetCacheStats(&tsStat, PHF_STATS) == -1)
    {  perror("");
       exit(-1);
    }

    printf("PHF - Hits:  %d, Attempts:  %d\n",
           tsStat.uiCacheHits, tsStat.uiTotalAttempts);
    Percentage = (double)((double)tsStat.uiCacheHits / 
                 (double)tsStat.uiTotalAttempts);
    printf("PHF Cache hit percentage:  %f\n", Percentage);

    if(PfGetCacheStats(&tsStat, TTF_STATS) == -1)
    {  perror("");
       exit(-1);
    }

    printf("TTF - Hits:  %d, Attempts:  %d\n",
           tsStat.uiCacheHits, tsStat.uiTotalAttempts);
    Percentage = (double)((double)tsStat.uiCacheHits /
                 (double)tsStat.uiTotalAttempts);
    printf("TTF Cache hit percentage:  %f\n", Percentage);

    if(PfGetCacheStats(&tsStat, PFR_STATS) == -1)
    {  perror("");
       exit(-1);
    }

    printf("PFR - Hits:  %d, Attempts:  %d\n",
           tsStat.uiCacheHits, tsStat.uiTotalAttempts);
    Percentage = (double)((double)tsStat.uiCacheHits /
                 (double)tsStat.uiTotalAttempts);
    printf("PFR Cache hit percentage:  %f\n", Percentage);

    return(0);
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

Fonts chapter of the Photon Programmer's Guide


[Previous] [Contents] [Index] [Next]