NumResourceUnits = R2VIndex;
ResourceUsage.resize(NumResourceUnits * (Source.size() + 1));
- std::fill(ResourceUsage.begin(), ResourceUsage.end(), 0);
+ std::fill(ResourceUsage.begin(), ResourceUsage.end(), 0.0);
}
void ResourcePressureView::onInstructionEvent(const HWInstructionEvent &Event) {
return;
const auto &IssueEvent = static_cast<const HWInstructionIssuedEvent &>(Event);
unsigned SourceIdx = Event.Index % Source.size();
- for (const std::pair<ResourceRef, unsigned> &Use : IssueEvent.UsedResources) {
+ for (const std::pair<ResourceRef, double> &Use : IssueEvent.UsedResources) {
const ResourceRef &RR = Use.first;
assert(Resource2VecIndex.find(RR.first) != Resource2VecIndex.end());
unsigned R2VIndex = Resource2VecIndex[RR.first];
TempStream << '\n';
for (unsigned I = 0, E = NumResourceUnits; I < E; ++I) {
- unsigned Usage = ResourceUsage[I + Source.size() * E];
+ double Usage = ResourceUsage[I + Source.size() * E];
if (!Usage) {
TempStream << " - ";
continue;
}
- double Pressure = (double)Usage / Executions;
+ double Pressure = Usage / Executions;
TempStream << format("%.2f", Pressure);
if (Pressure < 10.0)
TempStream << " ";
for (unsigned I = 0, E = Source.size(); I < E; ++I) {
for (unsigned J = 0; J < NumResourceUnits; ++J) {
- unsigned Usage = ResourceUsage[J + I * NumResourceUnits];
- if (Usage == 0) {
+ double Usage = ResourceUsage[J + I * NumResourceUnits];
+ if (!Usage) {
TempStream << " - ";
} else {
- double Pressure = (double)Usage / Executions;
+ double Pressure = Usage / Executions;
if (Pressure < 0.005) {
TempStream << " - ";
} else {
llvm::DenseMap<unsigned, unsigned> Resource2VecIndex;
// Table of resources used by instructions.
- std::vector<unsigned> ResourceUsage;
+ std::vector<double> ResourceUsage;
unsigned NumResourceUnits;
const llvm::MCInst &GetMCInstFromIndex(unsigned Index) const;