VirtualBox

Changeset 2030 in kBuild


Ignore:
Timestamp:
Nov 3, 2008 2:44:50 AM (16 years ago)
Author:
bird
Message:

misc.c: Implemented heap statistics output for MSC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/misc.c

    r1993 r2030  
    13421342
    13431343  malloc_zone_statistics (NULL, &s);
    1344   printf (_("\n# CRT Heap: %zu bytes in use, in %u block, avg %zu bytes/block\n"),
     1344  printf (_("\n# CRT Heap: %zu bytes in use, in %u blocks, avg %zu bytes/block\n"),
    13451345          s.size_in_use, s.blocks_in_use, s.size_in_use / s.blocks_in_use);
    13461346  printf (_("#           %zu bytes max in use (high water mark)\n"),
     
    13491349          s.size_allocated, s.size_allocated - s.size_in_use);
    13501350# endif /* __APPLE__ */
     1351
     1352  /* MSC / Windows  */
     1353# ifdef _MSC_VER
     1354  unsigned int blocks_used = 0;
     1355  unsigned int bytes_used = 0;
     1356  unsigned int blocks_avail = 0;
     1357  unsigned int bytes_avail = 0;
     1358  _HEAPINFO hinfo;
     1359
     1360  memset (&hinfo, '\0', sizeof (hinfo));
     1361  while (_heapwalk(&hinfo) == _HEAPOK)
     1362    {
     1363      if (hinfo._useflag == _USEDENTRY)
     1364        {
     1365          blocks_used++;
     1366          bytes_used += hinfo._size;
     1367        }
     1368      else
     1369        {
     1370          blocks_avail++;
     1371          bytes_avail += hinfo._size;
     1372        }
     1373    }
     1374
     1375  printf (_("\n# CRT Heap: %u bytes in use, in %u blocks, avg %u bytes/block\n"),
     1376          bytes_used, blocks_used, bytes_used / blocks_used);
     1377  printf (_("#           %u bytes avail, in %u blocks, avg %u bytes/block\n"),
     1378          bytes_avail, blocks_avail, bytes_avail / blocks_avail);
     1379# endif /* _MSC_VER */
    13511380
    13521381  /* Darwin Libc sources indicates that something like this may be
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette