| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 matchedPropertyCacheAdded = 0; | 53 matchedPropertyCacheAdded = 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 String StyleResolverStats::report() const | 56 String StyleResolverStats::report() const |
| 57 { | 57 { |
| 58 StringBuilder output; | 58 StringBuilder output; |
| 59 | 59 |
| 60 unsigned sharedStylesRejected = sharedStyleRejectedByUncommonAttributeRules
+ sharedStyleRejectedBySiblingRules + sharedStyleRejectedByParent; | 60 unsigned sharedStylesRejected = sharedStyleRejectedByUncommonAttributeRules
+ sharedStyleRejectedBySiblingRules + sharedStyleRejectedByParent; |
| 61 unsigned sharedStylesUsed = sharedStyleFound - sharedStylesRejected; | 61 unsigned sharedStylesUsed = sharedStyleFound - sharedStylesRejected; |
| 62 | 62 |
| 63 output.append("Style sharing:\n"); | 63 output.appendLiteral("Style sharing:\n"); |
| 64 output.append(String::format(" %u elements were added to the sharing candid
ate list.\n", sharedStyleCandidates)); | 64 output.append(String::format(" %u elements were added to the sharing candid
ate list.\n", sharedStyleCandidates)); |
| 65 output.append(String::format(" %u calls were made to findSharedStyle, %u fo
und a candidate to share with (%.2f%%).\n", sharedStyleLookups, sharedStyleFound
, PERCENT(sharedStyleFound, sharedStyleLookups))); | 65 output.append(String::format(" %u calls were made to findSharedStyle, %u fo
und a candidate to share with (%.2f%%).\n", sharedStyleLookups, sharedStyleFound
, PERCENT(sharedStyleFound, sharedStyleLookups))); |
| 66 if (printMissedCandidateCount) | 66 if (printMissedCandidateCount) |
| 67 output.append(String::format(" %u candidates could have matched but wer
e not in the list when searching (%.2f%%).\n", sharedStyleMissed, PERCENT(shared
StyleMissed, sharedStyleLookups))); | 67 output.append(String::format(" %u candidates could have matched but wer
e not in the list when searching (%.2f%%).\n", sharedStyleMissed, PERCENT(shared
StyleMissed, sharedStyleLookups))); |
| 68 output.append(String::format(" %u of found styles were rejected (%.2f%%), %
.2f%% by uncommon attribute rules, %.2f%% by sibling rules and %.2f%% by parents
disabling sharing.\n", | 68 output.append(String::format(" %u of found styles were rejected (%.2f%%), %
.2f%% by uncommon attribute rules, %.2f%% by sibling rules and %.2f%% by parents
disabling sharing.\n", |
| 69 sharedStylesRejected, | 69 sharedStylesRejected, |
| 70 PERCENT(sharedStylesRejected, sharedStyleFound), | 70 PERCENT(sharedStylesRejected, sharedStyleFound), |
| 71 PERCENT(sharedStyleRejectedByUncommonAttributeRules, sharedStylesRejecte
d), | 71 PERCENT(sharedStyleRejectedByUncommonAttributeRules, sharedStylesRejecte
d), |
| 72 PERCENT(sharedStyleRejectedBySiblingRules, sharedStylesRejected), | 72 PERCENT(sharedStyleRejectedBySiblingRules, sharedStylesRejected), |
| 73 PERCENT(sharedStyleRejectedByParent, sharedStylesRejected))); | 73 PERCENT(sharedStyleRejectedByParent, sharedStylesRejected))); |
| 74 output.append(String::format(" %u of found styles were used for sharing (%.
2f%%).\n", sharedStylesUsed, PERCENT(sharedStylesUsed, sharedStyleFound))); | 74 output.append(String::format(" %u of found styles were used for sharing (%.
2f%%).\n", sharedStylesUsed, PERCENT(sharedStylesUsed, sharedStyleFound))); |
| 75 output.append(String::format(" %.2f%% of calls to findSharedStyle returned
a shared style.\n", PERCENT(sharedStylesUsed, sharedStyleLookups))); | 75 output.append(String::format(" %.2f%% of calls to findSharedStyle returned
a shared style.\n", PERCENT(sharedStylesUsed, sharedStyleLookups))); |
| 76 | 76 |
| 77 output.append("\n"); | 77 output.append('\n'); |
| 78 | 78 |
| 79 output.append("Matched property cache:\n"); | 79 output.appendLiteral("Matched property cache:\n"); |
| 80 output.append(String::format(" %u calls to applyMatchedProperties, %u hit t
he cache (%.2f%%).\n", matchedPropertyApply, matchedPropertyCacheHit, PERCENT(ma
tchedPropertyCacheHit, matchedPropertyApply))); | 80 output.append(String::format(" %u calls to applyMatchedProperties, %u hit t
he cache (%.2f%%).\n", matchedPropertyApply, matchedPropertyCacheHit, PERCENT(ma
tchedPropertyCacheHit, matchedPropertyApply))); |
| 81 output.append(String::format(" %u cache hits also shared the inherited styl
e (%.2f%%).\n", matchedPropertyCacheInheritedHit, PERCENT(matchedPropertyCacheIn
heritedHit, matchedPropertyCacheHit))); | 81 output.append(String::format(" %u cache hits also shared the inherited styl
e (%.2f%%).\n", matchedPropertyCacheInheritedHit, PERCENT(matchedPropertyCacheIn
heritedHit, matchedPropertyCacheHit))); |
| 82 output.append(String::format(" %u styles created in applyMatchedProperties
were added to the cache (%.2f%%).\n", matchedPropertyCacheAdded, PERCENT(matched
PropertyCacheAdded, matchedPropertyApply))); | 82 output.append(String::format(" %u styles created in applyMatchedProperties
were added to the cache (%.2f%%).\n", matchedPropertyCacheAdded, PERCENT(matched
PropertyCacheAdded, matchedPropertyApply))); |
| 83 | 83 |
| 84 return output.toString(); | 84 return output.toString(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |