-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Log Memory.Footprint test results #8170
Conversation
@anandthakker, thanks for your PR! By analyzing this pull request, we identified @tmpsantos and @jfirebaugh to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Just one suggestion for output:
Vector: 6.74865e+07 OK
Raster: 2.43709e+07 OK
Can you change these to print in regular notation (or MB units)?
Can we hold on merging this? I would like to review it tomorrow with more time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't object to this change but looking carefully I don't see what value we are adding moving it from gtest
to gbenchmark
.
gbenchmark
was designed to see how many times you can run a test in a time frame and I would prefer to keep it this way.
For instance the json output of gbenchmark
with this test would be misleading.
Why not keep it on gtest
? I think for this particular case it is even more prepared for having a XML generated that we could use to plot a graph:
benchmark/include/mbgl/benchmark.hpp
Outdated
@@ -4,4 +4,5 @@ namespace mbgl { | |||
|
|||
int runBenchmark(int argc, char* argv[]); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
#include <unistd.h> | ||
|
||
/* | ||
* Begin getRSS.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to benchmark/src/mbgl/benchmark/getrss.c
? Maybe add the function prototypes to utils.hpp
.
|
||
namespace mbgl { | ||
namespace benchmark { | ||
bool memoryFootprintBenchmark(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, we don't indent inside the namespace
.travis.yml
Outdated
@@ -173,7 +173,8 @@ matrix: | |||
- mapbox_export_mesa_library_path | |||
script: | |||
- make qt-app | |||
- LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so make run-qt-test-Memory.*:*.Load | |||
- LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so make run-qt-test-*.Load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the other memory tests.
result.data = it->second; | ||
} else { | ||
auto data = std::make_shared<std::string>( | ||
util::read_file(std::string("test/fixtures/resources/") + path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy the test resources used by this test to benchmark/fixtures/
.
/** End getRSS.c */ | ||
|
||
|
||
using namespace mbgl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No needed, you are already using namespace mbgl {
test/util/memory.test.cpp
Outdated
std::unordered_map<std::string, std::shared_ptr<std::string>> cache; | ||
}; | ||
|
||
TEST(Memory, Vector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not remove this. These (Memory.Vector and Memory.Raster) are the only tests we have that do a full pass rendering inside valgrind looking for memory leaks.
Thanks for the review @tmpsantos
Somehow in my attempts to get gtest to simply log additional info to the screen, I missed this. You're right: if we can use gtest's existing functionality, then I should rework this PR to:
|
👍
This would be an amazing follow-up. There was prior work done here for binary size: Metrics can be seen here: |
c20f8d4
to
b9fac17
Compare
b9fac17
to
c9ae8b6
Compare
@tmpsantos updated to output results from gtest as we discussed, and laid the groundwork for reporting / visualizing the benchmark over time in It appears there isn't currently a nightly build for |
Even when we're passing this test, it can be very useful to have a log of the memory usage value, so that we can get a sense of the memory impact of new features and also to make sure that it's reasonable when we to increase the thresholds for these checks, when necessary.
Closes #8149 (leaving integration w/ the fancy nightly metrics graph for another day)