Modifying for use with destruct #5

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@bahamas10
Collaborator

I leave this up to you if you want to merge it or not.

I modified this to use the node destruct module I wrote to make unpacking values easier and cleaner.

Thought?

(tag @papertigers)

@dshaw dshaw commented on the diff Jul 19, 2012
lib/usage.js
if (typeof pid === 'function') {
callback = pid;
pid = 'self';
}
-
- fs.readFile('/proc/'+pid+'/usage', function (err, buf) {
+ parseProc('psinfo', 'iia8a8a8a8a8a8a8a8a8a8a8a8a8a8a48LLLLLLLLLLLLa40', keys, timespec_keys, pid, function(err, res) {
@dshaw
dshaw Jul 19, 2012 Owner

'iia8a8a8a8a8a8a8a8a8a8a8a8a8a8a48LLLLLLLLLLLLa40' - that's a crazy string. I love where you're going with this though. Seems much easier to manage.

@bahamas10
Collaborator

oh yeah, it's definitely a crazy string. I modeled the unpack function after the one in perl. if you search for one of those crazy strings you'll see 2 results. the node destruct module, and brendan gregg's prustat script.

https://duckduckgo.com/?q=iiiiiiiiiiIiiiiSSa8a8a8Z16Z80iiIIaa3iiiiii

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment