{"action":"created","issue":{"url":"https://api.github.com/repos/openscad/openscad/issues/1959","repository_url":"https://api.github.com/repos/openscad/openscad","labels_url":"https://api.github.com/repos/openscad/openscad/issues/1959/labels{/name}","comments_url":"https://api.github.com/repos/openscad/openscad/issues/1959/comments","events_url":"https://api.github.com/repos/openscad/openscad/issues/1959/events","html_url":"https://github.com/openscad/openscad/issues/1959","id":209889787,"number":1959,"title":"Feature request: system resource usage query command.","user":{"login":"royasutton","id":15184494,"avatar_url":"https://avatars1.githubusercontent.com/u/15184494?v=3","gravatar_id":"","url":"https://api.github.com/users/royasutton","html_url":"https://github.com/royasutton","followers_url":"https://api.github.com/users/royasutton/followers","following_url":"https://api.github.com/users/royasutton/following{/other_user}","gists_url":"https://api.github.com/users/royasutton/gists{/gist_id}","starred_url":"https://api.github.com/users/royasutton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royasutton/subscriptions","organizations_url":"https://api.github.com/users/royasutton/orgs","repos_url":"https://api.github.com/users/royasutton/repos","events_url":"https://api.github.com/users/royasutton/events{/privacy}","received_events_url":"https://api.github.com/users/royasutton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-23T21:29:50Z","updated_at":"2017-04-07T23:11:07Z","closed_at":null,"body":"New command that returns current system resource usage. The _getrusage_, get resource usage library, provides the need information. With such a command,  user-space libraries could be better optimized. The _getrusage_ library gives many use statistics. Would be nice to be able to specify the metrics of interested to be returned as a vector.\r\n\r\n**For example**:\r\n```\r\noptions = [\"utime\", \"systime\", \" maxrss\"];\r\n\r\nru0 = get_usage( options );\r\nresult1 = function1();\r\nru1 = get_usage( options );\r\nresult2 = function2();\r\nru2 = get_usage( options );\r\n\r\nutime1 = ru1[0] - ru0[0];\r\nutime2 = ru2[0] - ru1[0];\r\n\r\nif ( utime1 < utime2 )\r\n    echo(\"function1 is faster\");\r\n```"},"comment":{"url":"https://api.github.com/repos/openscad/openscad/issues/comments/292672884","html_url":"https://github.com/openscad/openscad/issues/1959#issuecomment-292672884","issue_url":"https://api.github.com/repos/openscad/openscad/issues/1959","id":292672884,"user":{"login":"royasutton","id":15184494,"avatar_url":"https://avatars1.githubusercontent.com/u/15184494?v=3","gravatar_id":"","url":"https://api.github.com/users/royasutton","html_url":"https://github.com/royasutton","followers_url":"https://api.github.com/users/royasutton/followers","following_url":"https://api.github.com/users/royasutton/following{/other_user}","gists_url":"https://api.github.com/users/royasutton/gists{/gist_id}","starred_url":"https://api.github.com/users/royasutton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royasutton/subscriptions","organizations_url":"https://api.github.com/users/royasutton/orgs","repos_url":"https://api.github.com/users/royasutton/repos","events_url":"https://api.github.com/users/royasutton/events{/privacy}","received_events_url":"https://api.github.com/users/royasutton/received_events","type":"User","site_admin":false},"created_at":"2017-04-07T23:11:07Z","updated_at":"2017-04-07T23:11:07Z","body":"My intention is with regards to library development and _dynamic code analysis_. I agree that one could do **coarse-grain** performance comparison from the command line. However, it becomes difficult to break things apart inside the code \"box\". At the command line level, it's easy to say box1 is better than box2. Which is fine in simple cases. But when one wants to optimize box1 or box2, a more **fine-grain** timing capability is needed.\r\n\r\nFor example,  if one was able to get time (or other resource) stamps from within a running script, one could begin to create performance profiles on sections of working code. This provides the key to in-the-box optimization.\r\n\r\nI currently know nothing about the internals of OpenSCAD and with my 0-experience, it seemed like some low-hanging fruit that should not be too intrusive (it would only be used when needed for development, optimization, analysis, etc).\r\n"}}
{"actor":{"display_login":"royasutton"}}