Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
5.0 KiB

  1. ###################################################################################
  2. # #
  3. # Copyright (c) 1989-1999 Microsoft Corporation #
  4. # #
  5. # Module Name: #
  6. # #
  7. # stringinfo.pl #
  8. # #
  9. # Abstract: #
  10. # #
  11. # Computes statistics from MIDL format string instrumentation. #
  12. # #
  13. # Notes: #
  14. # #
  15. # History: #
  16. # #
  17. # Oct-26-99 mzoran Created. #
  18. # #
  19. # #
  20. ###################################################################################
  21. $RemoveDuplicateSymbols = 1;
  22. @procbuckets = (100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 1000000);
  23. @procbucketvalues = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  24. @typebuckets = (100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 1000000);
  25. @typebucketvalues = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  26. $numbuckets = 14;
  27. %Names;
  28. @ProcList;
  29. @TypeList;
  30. $MinProcSize = 100000000;
  31. $MinProcName = "";
  32. $MaxProcSize = 0;
  33. $MaxProcName = "";
  34. $TotalProcSize = 0;
  35. $NumberProcs = 0;
  36. $MinTypeSize = 100000000;
  37. $MinTypeName = "";
  38. $MaxTypeSize = 0;
  39. $MaxTypeName = "";
  40. $TotalTypeSize = 0;
  41. $NumberTypes = 0;
  42. while($line = <STDIN>) {
  43. $file = "";
  44. $type = "";
  45. $size = 0;
  46. ($file,$type,$size) = split(" ",$line);
  47. print("Processing $file, $type, $size\n");
  48. if (exists($Names{$file.$type}))
  49. {
  50. print("Skipping $file $type\n");
  51. }
  52. else
  53. {
  54. $Names{$file.$type} = 0;
  55. if ($type eq "TYPE_FORMAT_STRING_SIZE")
  56. {
  57. push (@TypeList, $size);
  58. if ($size > $MaxTypeSize) {
  59. $MaxTypeSize = $size;
  60. $MaxTypeName = $file;
  61. }
  62. if ($size < $MinTypeSize) {
  63. $MinTypeSize = $size;
  64. $MinTypeName = $file;
  65. }
  66. $TotalTypeSize += $size;
  67. $NumberTypes++;
  68. }
  69. elsif ($type eq "PROC_FORMAT_STRING_SIZE")
  70. {
  71. push (@ProcList, $size);
  72. if ($size > $MaxProcSize) {
  73. $MaxProcSize = $size;
  74. $MaxProcName = $file;
  75. }
  76. if ($size < $MinProcSize) {
  77. $MinProcSize = $size;
  78. $MinProcName = $file;
  79. }
  80. $TotalProcSize += $size;
  81. $NumberProcs++;
  82. }
  83. else
  84. {
  85. print ("Unknow type: $type. Skipping..\n");
  86. }
  87. }
  88. }
  89. print("\n\n");
  90. print("Numbers are for 32bit only.\n");
  91. print("\n");
  92. print("Total proc string size: $TotalProcSize\n");
  93. print("Number proc strings: $NumberProcs\n");
  94. print("Min proc string: $MinProcSize($MinProcName)\n");
  95. print("Max proc string: $MaxProcSize($MaxProcName)\n");
  96. print("Average proc size: ".($TotalProcSize / $NumberProcs)."\n");
  97. foreach $i (@ProcList)
  98. {
  99. for($j = 0; 1; $j++)
  100. {
  101. if ($i <= $procbuckets[$j])
  102. {
  103. $procbucketvalues[$j]++;
  104. last;
  105. }
  106. }
  107. }
  108. print("Proc size histogram:\n");
  109. for($i = 0; $i < $numbuckets; $i++)
  110. {
  111. print("$procbuckets[$i] \t");
  112. }
  113. print("\n");
  114. for($i = 0; $i < $numbuckets; $i++)
  115. {
  116. print("$procbucketvalues[$i] \t");
  117. }
  118. print("\n");
  119. print("\n");
  120. print("Total Types string size: $TotalTypeSize\n");
  121. print("Number proc strings: $NumberTypes\n");
  122. print("Min type string: $MinTypeSize($MinTypeName)\n");
  123. print("Max type string: $MaxTypeSize($MaxTypeName)\n");
  124. print("Average type size: ".($TotalTypeSize / $NumberTypes)."\n");
  125. foreach $i (@TypeList)
  126. {
  127. for($j = 0; 1; $j++)
  128. {
  129. if ($i <= $typebuckets[$j])
  130. {
  131. $typebucketvalues[$j]++;
  132. last;
  133. }
  134. }
  135. }
  136. print("Type size histogram:\n");
  137. for($i = 0; $i < $numbuckets; $i++)
  138. {
  139. print("$typebuckets[$i] \t");
  140. }
  141. print("\n");
  142. for($i = 0; $i < $numbuckets; $i++)
  143. {
  144. print("$typebucketvalues[$i] \t");
  145. }