Merge: Basic Memory Profiler
authorJean Privat <jean@pryen.org>
Fri, 24 Jun 2016 19:19:04 +0000 (15:19 -0400)
committerJean Privat <jean@pryen.org>
Fri, 24 Jun 2016 19:19:04 +0000 (15:19 -0400)
commit0bd93de684a38b2fb3c2269e885726d9618f5d65
treebc89832f8160f7aeefc7d41907a4d3fc5446ef69
parent636d488619c56d9dd27c675224e6c25263bb2bb9
parent36fb095ca3986c66d1f871b747ddb74443e200b1
Merge: Basic Memory Profiler

Here a proof of concept of a basic memory profiler for Nit.
The approach is an option `--trace-memory` that generate a logger with the rest of the code.
Each allocation event produce a line in an time-stamped log file.

When compiling nitc with nitc, the generated log is 300MB. Quite big but manageable.
There is not a lot of optimizations, we let the libc cache the writing of the log.
So there is an overhead.

without `--trace-memory`:
* real 0m5.721s
* user 0m7.216s

with it
* real  0m8.730s (+52%, beause IO I think)
* user 0m9.600s (+33%)

To process the log file, a autonomous tool `memplot` is provided that is made of a nit converter to csv and a R plot script.
There is not a lot of usability, configuration is done by hacking the source code :)

Here a result for the nitc compilation

![memory](https://cloud.githubusercontent.com/assets/135828/16327063/245d273c-399a-11e6-82d3-950db85f7326.png)

The PR is divided into 3 parts:

* preparation of the infrastructure in the compiler (agnostic)
* extension of nitc that refines methods to add the logger
* the quick and dirty memplot tool

Pull-Request: #2200
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>