/[freetype]/freetype2/src/base/ftdbgmem.c
ViewVC logotype

Diff of /freetype2/src/base/ftdbgmem.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by freetype, Sat Feb 26 00:12:04 2005 UTC revision 1.25 by freetype, Mon Feb 28 22:09:07 2005 UTC
# Line 921  Line 921 
921    }    }
922    
923    
924      static int
925      ft_mem_source_compare( const void*  p1,
926                             const void*  p2 )
927      {
928        FT_MemSource  s1 = *(FT_MemSource*)p1;
929        FT_MemSource  s2 = *(FT_MemSource*)p2;
930    
931        if ( s2->max_size > s1->max_size )
932          return 1;
933        else if ( s2->max_size < s1->max_size )
934          return -1;
935        else
936          return 0;
937      }
938    
939    
940    extern void    extern void
941    FT_DumpMemory( FT_Memory  memory )    FT_DumpMemory( FT_Memory  memory )
942    {    {
# Line 931  Line 947 
947      {      {
948        FT_MemSource* bucket = table->sources;        FT_MemSource* bucket = table->sources;
949        FT_MemSource* limit  = bucket + FT_MEM_SOURCE_BUCKETS;        FT_MemSource* limit  = bucket + FT_MEM_SOURCE_BUCKETS;
950          FT_MemSource* sources;
951          FT_UInt       nn, count;
952        const char*   fmt;        const char*   fmt;
953    
954          count = 0;
955          for ( ; bucket < limit; bucket++ )
956          {
957            FT_MemSource  source = *bucket;
958    
959            for ( ; source; source = source->link )
960              count++;
961          }
962    
963          sources = ft_mem_table_alloc( table, sizeof(*sources) * count );
964    
965          count = 0;
966          for ( bucket = table->sources; bucket < limit; bucket++ )
967          {
968            FT_MemSource  source = *bucket;
969    
970            for ( ; source; source = source->link )
971              sources[count++] = source;
972          }
973    
974          ft_qsort( sources, count, sizeof(*sources), ft_mem_source_compare );
975    
976        printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n",        printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n",
977                table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count );                table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count );
978        printf( " block  block    sizes    sizes    sizes   source\n" );        printf( " block  block    sizes    sizes    sizes   source\n" );
# Line 940  Line 980 
980        printf( "-------------------------------------------------\n" );        printf( "-------------------------------------------------\n" );
981        fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";        fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
982    
983        for ( ; bucket < limit; bucket++ )        for ( nn = 0; nn < count; nn++ )
984        {        {
985          FT_MemSource  source = *bucket;          FT_MemSource  source = sources[nn];
986    
987          for ( ; source; source = source->link )          printf( fmt,
988          {                  source->cur_blocks, source->max_blocks,
989            printf( fmt,                  source->cur_size,   source->max_size, source->cur_max,
990                    source->cur_blocks, source->max_blocks,                  FT_FILENAME( source->file_name ),
991                    source->cur_size,   source->max_size, source->cur_max,                  source->line_no );
                   FT_FILENAME( source->file_name ),  
                   source->line_no );  
         }  
992        }        }
993        printf( "------------------------------------------------\n" );        printf( "------------------------------------------------\n" );
994    
995          ft_mem_table_free( table, sources );
996      }      }
997    }    }
998    

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26