mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-08 21:34:25 +00:00
chore(kb): how to measure memory consumption for programs
This commit is contained in:
43
knowledge base/check performance of programs.md
Normal file
43
knowledge base/check performance of programs.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Check performance of programs
|
||||
|
||||
1. [GNU time](#gnu-time)
|
||||
1. [Valgrind](#valgrind)
|
||||
1. [Further readings](#further-readings)
|
||||
1. [Sources](#sources)
|
||||
|
||||
## GNU time
|
||||
|
||||
```sh
|
||||
# On Mac OS X.
|
||||
brew install 'gnu-time'
|
||||
gtime -v pulumi preview
|
||||
```
|
||||
|
||||
## Valgrind
|
||||
|
||||
```sh
|
||||
valgrind --tool='massif' pulumi preview
|
||||
ms_print 'massif.out.12345'
|
||||
```
|
||||
|
||||
## Further readings
|
||||
|
||||
- [Valgrind]
|
||||
|
||||
### Sources
|
||||
|
||||
- [How can I measure the actual memory usage of an application or process?]
|
||||
|
||||
<!--
|
||||
Reference
|
||||
═╬═Time══
|
||||
-->
|
||||
|
||||
<!-- In-article sections -->
|
||||
<!-- Knowledge base -->
|
||||
[valgrind]: valgrind.md
|
||||
|
||||
<!-- Files -->
|
||||
<!-- Upstream -->
|
||||
<!-- Others -->
|
||||
[how can i measure the actual memory usage of an application or process?]: https://stackoverflow.com/questions/131303/how-can-i-measure-the-actual-memory-usage-of-an-application-or-process
|
||||
71
knowledge base/valgrind.md
Normal file
71
knowledge base/valgrind.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# Valgrind
|
||||
|
||||
TODO
|
||||
|
||||
1. [TL;DR](#tldr)
|
||||
1. [Further readings](#further-readings)
|
||||
1. [Sources](#sources)
|
||||
|
||||
## TL;DR
|
||||
|
||||
<details>
|
||||
<summary>Setup</summary>
|
||||
|
||||
```sh
|
||||
# Install from source.
|
||||
git clone 'https://sourceware.org/git/valgrind.git'
|
||||
cd 'valgrind'
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
# Install using packages.
|
||||
sudo zypper install 'valgrind'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Usage</summary>
|
||||
|
||||
```sh
|
||||
# Measure how much heap memory a program uses.
|
||||
valgrind --tool='massif' pulumi preview
|
||||
|
||||
# Get summary statistics from dump taken with massif.
|
||||
ms_print 'massif.out.12345'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<!-- Uncomment if used
|
||||
<details>
|
||||
<summary>Real world use cases</summary>
|
||||
|
||||
```sh
|
||||
```
|
||||
|
||||
</details>
|
||||
-->
|
||||
|
||||
## Further readings
|
||||
|
||||
- [Website]
|
||||
- [Main repository]
|
||||
|
||||
### Sources
|
||||
|
||||
<!--
|
||||
Reference
|
||||
═╬═Time══
|
||||
-->
|
||||
|
||||
<!-- In-article sections -->
|
||||
<!-- Knowledge base -->
|
||||
<!-- Files -->
|
||||
<!-- Upstream -->
|
||||
[main repository]: https://sourceware.org/git/valgrind.git
|
||||
[website]: https://valgrind.org/
|
||||
|
||||
<!-- Others -->
|
||||
Reference in New Issue
Block a user