Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    ra47fe52 rc58ead7  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  2 18:48:30 2023
    13 // Update Count     : 1614
     12// Last Modified On : Mon Sep 11 11:21:10 2023
     13// Update Count     : 1615
    1414//
    1515
     
    691691        return stats;
    692692} // collectStats
     693
     694static inline void clearStats() {
     695        lock( mgrLock );
     696
     697        // Zero the heap master and all active thread heaps.
     698        HeapStatisticsCtor( heapMaster.stats );
     699        for ( Heap * heap = heapMaster.heapManagersList; heap; heap = heap->nextHeapManager ) {
     700                HeapStatisticsCtor( heap->stats );
     701        } // for
     702
     703        unlock( mgrLock );
     704} // clearStats
    693705#endif // __STATISTICS__
    694706
     
    15561568
    15571569
     1570        // Zero the heap master and all active thread heaps.
     1571        void malloc_stats_clear() {
     1572                #ifdef __STATISTICS__
     1573                clearStats();
     1574                #else
     1575                #define MALLOC_STATS_MSG "malloc_stats statistics disabled.\n"
     1576                if ( write( STDERR_FILENO, MALLOC_STATS_MSG, sizeof( MALLOC_STATS_MSG ) - 1 /* size includes '\0' */ ) == -1 ) {
     1577                        abort( "**** Error **** write failed in malloc_stats" );
     1578                } // if
     1579                #endif // __STATISTICS__
     1580        } // malloc_stats_clear
     1581
     1582
    15581583        // Changes the file descriptor where malloc_stats() writes statistics.
    15591584        int malloc_stats_fd( int fd __attribute__(( unused )) ) libcfa_public {
Note: See TracChangeset for help on using the changeset viewer.