[llvm] r264686 - Sample profile summary cleanup

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 16:14:30 PDT 2016


Author: eraman
Date: Mon Mar 28 18:14:29 2016
New Revision: 264686

URL: http://llvm.org/viewvc/llvm-project?rev=264686&view=rev
Log:
Sample profile summary cleanup

Replace references to MaxHeadSamples with MaxFunctionCount

Differential Revision: http://reviews.llvm.org/D18522


Modified:
    llvm/trunk/include/llvm/ProfileData/ProfileCommon.h
    llvm/trunk/include/llvm/ProfileData/SampleProfReader.h
    llvm/trunk/lib/ProfileData/ProfileSummary.cpp
    llvm/trunk/lib/ProfileData/SampleProfWriter.cpp
    llvm/trunk/unittests/ProfileData/SampleProfTest.cpp

Modified: llvm/trunk/include/llvm/ProfileData/ProfileCommon.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/ProfileCommon.h?rev=264686&r1=264685&r2=264686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/ProfileCommon.h (original)
+++ llvm/trunk/include/llvm/ProfileData/ProfileCommon.h Mon Mar 28 18:14:29 2016
@@ -150,17 +150,16 @@ protected:
 public:
   uint32_t getNumLinesWithSamples() { return NumCounts; }
   uint64_t getTotalSamples() { return TotalCount; }
-  uint64_t getMaxHeadSamples() { return MaxFunctionCount; }
   uint64_t getMaxSamplesPerLine() { return MaxCount; }
   void addRecord(const sampleprof::FunctionSamples &FS);
   SampleProfileSummary(std::vector<uint32_t> Cutoffs)
       : ProfileSummary(PSK_Sample, Cutoffs) {}
   SampleProfileSummary(uint64_t TotalSamples, uint64_t MaxSamplesPerLine,
-                       uint64_t MaxHeadSamples, int32_t NumLinesWithSamples,
+                       uint64_t MaxFunctionCount, int32_t NumLinesWithSamples,
                        uint32_t NumFunctions,
                        SummaryEntryVector DetailedSummary)
       : ProfileSummary(PSK_Sample, DetailedSummary, TotalSamples,
-                       MaxSamplesPerLine, MaxHeadSamples, NumLinesWithSamples,
+                       MaxSamplesPerLine, MaxFunctionCount, NumLinesWithSamples,
                        NumFunctions) {}
   static bool classof(const ProfileSummary *PS) {
     return PS->getKind() == PSK_Sample;

Modified: llvm/trunk/include/llvm/ProfileData/SampleProfReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/SampleProfReader.h?rev=264686&r1=264685&r2=264686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/SampleProfReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/SampleProfReader.h Mon Mar 28 18:14:29 2016
@@ -134,8 +134,8 @@
 //        Total number of samples in the profile.
 //    MAX_COUNT (uint64_t)
 //        Maximum value of samples on a line.
-//    MAX_HEAD_SAMPLES (uint64_t)
-//        Maximum number of head samples.
+//    MAX_FUNCTION_COUNT (uint64_t)
+//        Maximum number of samples at function entry (head samples).
 //    NUM_COUNTS (uint64_t)
 //        Number of lines with samples.
 //    NUM_FUNCTIONS (uint64_t)

Modified: llvm/trunk/lib/ProfileData/ProfileSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/ProfileSummary.cpp?rev=264686&r1=264685&r2=264686&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/ProfileSummary.cpp (original)
+++ llvm/trunk/lib/ProfileData/ProfileSummary.cpp Mon Mar 28 18:14:29 2016
@@ -214,7 +214,7 @@ SampleProfileSummary::getFormatSpecificM
   Components.push_back(
       getKeyValMD(Context, "MaxSamplesPerLine", getMaxSamplesPerLine()));
   Components.push_back(
-      getKeyValMD(Context, "MaxHeadSamples", getMaxHeadSamples()));
+      getKeyValMD(Context, "MaxFunctionCount", getMaxFunctionCount()));
   Components.push_back(
       getKeyValMD(Context, "NumLinesWithSamples", getNumLinesWithSamples()));
   Components.push_back(getKeyValMD(Context, "NumFunctions", NumFunctions));
@@ -318,8 +318,8 @@ static ProfileSummary *getInstrProfSumma
 
 // Parse an MDTuple representing a SampleProfileSummary object.
 static ProfileSummary *getSampleProfileSummaryFromMD(MDTuple *Tuple) {
-  uint64_t TotalSamples, MaxSamplesPerLine, MaxHeadSamples, NumLinesWithSamples,
-      NumFunctions;
+  uint64_t TotalSamples, MaxSamplesPerLine, MaxFunctionCount,
+      NumLinesWithSamples, NumFunctions;
   SummaryEntryVector Summary;
 
   if (Tuple->getNumOperands() != 7)
@@ -332,8 +332,8 @@ static ProfileSummary *getSampleProfileS
   if (!getVal(dyn_cast<MDTuple>(Tuple->getOperand(2)), "MaxSamplesPerLine",
               MaxSamplesPerLine))
     return nullptr;
-  if (!getVal(dyn_cast<MDTuple>(Tuple->getOperand(3)), "MaxHeadSamples",
-              MaxHeadSamples))
+  if (!getVal(dyn_cast<MDTuple>(Tuple->getOperand(3)), "MaxFunctionCount",
+              MaxFunctionCount))
     return nullptr;
   if (!getVal(dyn_cast<MDTuple>(Tuple->getOperand(4)), "NumLinesWithSamples",
               NumLinesWithSamples))
@@ -344,7 +344,7 @@ static ProfileSummary *getSampleProfileS
   if (!getSummaryFromMD(dyn_cast<MDTuple>(Tuple->getOperand(6)), Summary))
     return nullptr;
   return new SampleProfileSummary(TotalSamples, MaxSamplesPerLine,
-                                  MaxHeadSamples, NumLinesWithSamples,
+                                  MaxFunctionCount, NumLinesWithSamples,
                                   NumFunctions, Summary);
 }
 

Modified: llvm/trunk/lib/ProfileData/SampleProfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/SampleProfWriter.cpp?rev=264686&r1=264685&r2=264686&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/SampleProfWriter.cpp (original)
+++ llvm/trunk/lib/ProfileData/SampleProfWriter.cpp Mon Mar 28 18:14:29 2016
@@ -140,7 +140,7 @@ std::error_code SampleProfileWriterBinar
   auto &OS = *OutputStream;
   encodeULEB128(Summary->getTotalSamples(), OS);
   encodeULEB128(Summary->getMaxSamplesPerLine(), OS);
-  encodeULEB128(Summary->getMaxHeadSamples(), OS);
+  encodeULEB128(Summary->getMaxFunctionCount(), OS);
   encodeULEB128(Summary->getNumLinesWithSamples(), OS);
   encodeULEB128(Summary->getNumFunctions(), OS);
   std::vector<ProfileSummaryEntry> &Entries = Summary->getDetailedSummary();

Modified: llvm/trunk/unittests/ProfileData/SampleProfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/SampleProfTest.cpp?rev=264686&r1=264685&r2=264686&view=diff
==============================================================================
--- llvm/trunk/unittests/ProfileData/SampleProfTest.cpp (original)
+++ llvm/trunk/unittests/ProfileData/SampleProfTest.cpp Mon Mar 28 18:14:29 2016
@@ -100,7 +100,7 @@ struct SampleProfTest : ::testing::Test
       ASSERT_EQ(123603u, Summary.getTotalSamples());
       ASSERT_EQ(6u, Summary.getNumLinesWithSamples());
       ASSERT_EQ(2u, Summary.getNumFunctions());
-      ASSERT_EQ(1437u, Summary.getMaxHeadSamples());
+      ASSERT_EQ(1437u, Summary.getMaxFunctionCount());
       ASSERT_EQ(60351u, Summary.getMaxSamplesPerLine());
 
       uint32_t Cutoff = 800000;




More information about the llvm-commits mailing list