Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev fix implicit conversion #3527

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pxr/imaging/hd/testenv/testHdSortedIds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ _InitPaths()
}

// Shuffle paths randomly.
const size_t seed =
std::chrono::system_clock::now().time_since_epoch().count();
const std::mt19937::result_type seed =
static_cast<std::mt19937::result_type>(std::chrono::system_clock::now().time_since_epoch().count());
std::cout << "Random seed: " << seed << "\n";
std::mt19937 randomGen(seed);

Expand Down Expand Up @@ -371,7 +371,7 @@ bool
InsertRemoveDupesTest()
{
std::cout << "\n\nInsertRemoveDupesTest():\n";

using P = SdfPath;
Hd_SortedIds sortedIds;
SdfPathVector expected;
Expand All @@ -381,7 +381,7 @@ InsertRemoveDupesTest()

expected = {P("/A"),P("/B")};
TF_AXIOM(sortedIds.GetIds() == expected);

sortedIds.Insert(P("/B"));
sortedIds.Insert(P("/A"));
sortedIds.Insert(P("/B"));
Expand Down
22 changes: 11 additions & 11 deletions pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ _GetInitPaths()
{
static SdfPathVector theInitPaths = []() {
SdfPathVector paths;

char primName[] = "/_/_/_/_";

for (size_t firstLevel = 0; firstLevel < numFirstLevel; ++firstLevel) {
primName[1] = firstLevelChar[firstLevel];
for (char secondLevel = 'A'; secondLevel <= 'Z'; ++secondLevel) {
Expand All @@ -44,12 +44,12 @@ _GetInitPaths()
}
}
// Shuffle paths randomly.
const size_t seed = 5109223000;
const std::mt19937::result_type seed = static_cast<std::mt19937::result_type>(5109223000);
std::mt19937 randomGen(seed);
std::shuffle(paths.begin(), paths.end(), randomGen);

printf("Using %zu initial paths\n", paths.size());

return paths;
}();

Expand Down Expand Up @@ -146,7 +146,7 @@ MultiRemoveInsertTest(Metrics &metrics)
}
ids.GetIds(); // force sort.
});

metrics.emplace_back("add_del_multiple", ArchTicksToNanoseconds(ticks));
}

Expand Down Expand Up @@ -180,7 +180,7 @@ SubtreeRemoveInsertTest(Metrics &metrics)
Hd_SortedIds ids = _GetPopulatedIds();

std::vector<int64_t> timings;

for (SdfPathVector const &subtreePaths: subtreePathVecs) {
timings.push_back(
ArchMeasureExecutionTime([&ids, &subtreePaths]() {
Expand Down Expand Up @@ -232,7 +232,7 @@ PartialSubtreeRemoveInsertTest(Metrics &metrics)
Hd_SortedIds ids = _GetPopulatedIds();

std::vector<int64_t> timings;

for (SdfPathVector const &subtreePaths: subtreePathVecs) {
timings.push_back(
ArchMeasureExecutionTime([&ids, &subtreePaths]() {
Expand Down Expand Up @@ -300,7 +300,7 @@ SpreadRemoveInsertTest(Metrics &metrics, size_t numElts)
size_t idx = (ids.GetIds().size() * (x+1)) / (numElts+1);
paths.push_back(ids.GetIds()[idx]);
}

int64_t ticks = ArchMeasureExecutionTime([&ids, &paths]() {
for (SdfPath const &path: paths) {
ids.Remove(path);
Expand Down Expand Up @@ -357,7 +357,7 @@ SubtreeRenameTest(Metrics &metrics,
int main()
{
Metrics metrics;

PopulateTest(metrics);
SingleRemoveInsertTest(metrics);
MultiRemoveInsertTest(metrics);
Expand All @@ -380,7 +380,7 @@ int main()
SubtreeRenameTest(metrics, SdfPath("/A/B/C"), SdfPath("/A/B/_C"));
SubtreeRenameTest(metrics, SdfPath("/A/B"), SdfPath("/A/_B"));
SubtreeRenameTest(metrics, SdfPath("/Z/Z"), SdfPath("/A/B/_Z"));

FILE *statsFile = fopen("perfstats.raw", "w");
for (const auto &[metricName, ns]: metrics) {
fprintf(statsFile,
Expand All @@ -389,6 +389,6 @@ int main()
printf("%s : %zd ns\n", metricName.c_str(), ns);
}
fclose(statsFile);

printf("OK\n");
}