OLD | NEW |
(Empty) | |
| 1 //===- NaClBitcodeBitsAndAbbrevsDist.cpp ------------------*- C++ -*-===// |
| 2 // Implements distributions of values with the corresponding |
| 3 // number of bits and percentage of abbreviations used in PNaCl |
| 4 // bitcode records. |
| 5 // |
| 6 // The LLVM Compiler Infrastructure |
| 7 // |
| 8 // This file is distributed under the University of Illinois Open Source |
| 9 // License. See LICENSE.TXT for details. |
| 10 // |
| 11 //===----------------------------------------------------------------------===// |
| 12 |
| 13 #include "llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h" |
| 14 |
| 15 using namespace llvm; |
| 16 |
| 17 NaClBitcodeBitsAndAbbrevsDistElement::~NaClBitcodeBitsAndAbbrevsDistElement() {} |
| 18 |
| 19 void NaClBitcodeBitsAndAbbrevsDistElement:: |
| 20 AddRecord(const NaClBitcodeRecord &Record) { |
| 21 NaClBitcodeBitsDistElement::AddRecord(Record); |
| 22 if (Record.UsedAnAbbreviation()) { |
| 23 ++NumAbbrevs; |
| 24 } |
| 25 } |
| 26 |
| 27 void NaClBitcodeBitsAndAbbrevsDistElement:: |
| 28 PrintStatsHeader(raw_ostream &Stream) const { |
| 29 NaClBitcodeBitsDistElement::PrintStatsHeader(Stream); |
| 30 Stream << " % Abv"; |
| 31 } |
| 32 |
| 33 void NaClBitcodeBitsAndAbbrevsDistElement:: |
| 34 PrintRowStats(raw_ostream &Stream, |
| 35 const NaClBitcodeDist *Distribution) const { |
| 36 NaClBitcodeBitsDistElement::PrintRowStats(Stream, Distribution); |
| 37 if (GetNumAbbrevs()) |
| 38 Stream << format(" %7.2f", |
| 39 (double) GetNumAbbrevs()/GetNumInstances()*100.0); |
| 40 else |
| 41 Stream << " "; |
| 42 } |
OLD | NEW |