Changeset 8eec3c8 in mainline for uspace/lib/c/generic/stats.c


Ignore:
Timestamp:
2010-06-10T14:24:50Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c0f13d2
Parents:
1113c9e
Message:

merge basic exception accounting (this is the last piece missing from the original "measure" branch by Stanislav Kozina)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/stats.c

    r1113c9e r8eec3c8  
    184184}
    185185
     186/** Get exception statistics.
     187 *
     188 * @param count Number of records returned.
     189 *
     190 * @return Array of stats_exc_t structures.
     191 *         If non-NULL then it should be eventually freed
     192 *         by free().
     193 *
     194 */
     195stats_exc_t *stats_get_exceptions(size_t *count)
     196{
     197        size_t size = 0;
     198        stats_exc_t *stats_exceptions =
     199            (stats_exc_t *) sysinfo_get_data("system.exceptions", &size);
     200       
     201        assert((size % sizeof(stats_exc_t)) == 0);
     202       
     203        *count = size / sizeof(stats_exc_t);
     204        return stats_exceptions;
     205}
     206
     207/** Get single exception statistics
     208 *
     209 * @param excn Exception number we are interested in.
     210 *
     211 * @return Pointer to the stats_exc_t structure.
     212 *         If non-NULL then it should be eventually freed
     213 *         by free().
     214 *
     215 */
     216stats_exc_t *stats_get_exception(unsigned int excn)
     217{
     218        char name[SYSINFO_STATS_MAX_PATH];
     219        snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptionss.%u", excn);
     220       
     221        size_t size = 0;
     222        stats_exc_t *stats_exception =
     223            (stats_exc_t *) sysinfo_get_data(name, &size);
     224       
     225        assert((size == sizeof(stats_exc_t)) || (size == 0));
     226       
     227        return stats_exception;
     228}
     229
    186230/** Get system load
    187231 *
Note: See TracChangeset for help on using the changeset viewer.