I’ve made a mix task to profile an algorithm in Backtrex. Performance characteristics may vary between machines, so I want to annotate the reports with metadata about the node’s available resources (CPU, RAM, OS, BEAM VM metrics etc.).
Are there recommended tools for collecting these sort of data? I found Erlang’s os_mon, but maybe there are Elixir wrappers or alternatives. Even calling an external program is acceptable. I’d like to store the metadata as some kind of key-value mapping file (perhaps even nested like JSON), so it’s easy to add more metadata in the future without breaking the existing conventions.
Also, based on your experiences optimizing code and identifying resource bottlenecks, what data would you generally want collected?
os_mon is the way to go, and there tend to be no Elixir wrappers for erlang libraries unless the wrappers actually add something, just renaming it to be CamelCase instead of snake-case tends to not be enough of a reason. ^.^
os_mon is a good start, and also look at the erlang code in the observer application, it grabs a lot of useful data, shows you how to make the internal OTP calls to get mailbox size, stack used of processes, etc… etc…