{"action":"created","issue":{"url":"https://api.github.com/repos/oshi/oshi/issues/488","repository_url":"https://api.github.com/repos/oshi/oshi","labels_url":"https://api.github.com/repos/oshi/oshi/issues/488/labels{/name}","comments_url":"https://api.github.com/repos/oshi/oshi/issues/488/comments","events_url":"https://api.github.com/repos/oshi/oshi/issues/488/events","html_url":"https://github.com/oshi/oshi/issues/488","id":322336761,"number":488,"title":"Processor count retrieval on Solaris","user":{"login":"Kald0","id":36925371,"avatar_url":"https://avatars2.githubusercontent.com/u/36925371?v=4","gravatar_id":"","url":"https://api.github.com/users/Kald0","html_url":"https://github.com/Kald0","followers_url":"https://api.github.com/users/Kald0/followers","following_url":"https://api.github.com/users/Kald0/following{/other_user}","gists_url":"https://api.github.com/users/Kald0/gists{/gist_id}","starred_url":"https://api.github.com/users/Kald0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kald0/subscriptions","organizations_url":"https://api.github.com/users/Kald0/orgs","repos_url":"https://api.github.com/users/Kald0/repos","events_url":"https://api.github.com/users/Kald0/events{/privacy}","received_events_url":"https://api.github.com/users/Kald0/received_events","type":"User","site_admin":false},"labels":[{"id":509799600,"url":"https://api.github.com/repos/oshi/oshi/labels/PR%20welcome","name":"PR welcome","color":"006b75","default":false},{"id":143889198,"url":"https://api.github.com/repos/oshi/oshi/labels/confirmed%20bug","name":"confirmed bug","color":"e11d21","default":false},{"id":726876584,"url":"https://api.github.com/repos/oshi/oshi/labels/good%20first%20issue","name":"good first issue","color":"8aed76","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-11T15:22:51Z","updated_at":"2018-05-11T16:16:22Z","closed_at":null,"author_association":"NONE","body":"The Processor count retrieval on Oracle Solaris 11.3 SPARC doesn't work as expected.\r\nWhen the **CentralProcessor** is retrieved with the following command\r\n_CentralProcessor processor = new SystemInfo().getHardware().getProcessor();_\r\nthe following error is displayed in the output:\r\nERROR oshi.hardware.platform.unix.solaris.SolarisCentralProcessor - Couldn't find logical processor count. Assuming 1.\r\n\r\nThe issue happens in the _calculateProcessorCounts_ method of the **SolarisCentralProcessor** class.\r\nThe command **psrinfo -pv** doesn't return any string that is matched with the _PSRINFO_ pattern.\r\nHere's an example of what the function actually returns:\r\n\r\n> The physical processor has 2 cores and 16 virtual processors (0-15)\r\n> The core has 8 virtual processors (0-7)\r\n> The core has 8 virtual processors (8-15)\r\n> sun4v-cpu (chipid 0, clock 2998 MHz)  \r\n\r\nThe issue can be fixed by using the following pattern:\r\n`.*physical processor has (\\\\d+) cores and (\\\\d+) virtual processors.*`\r\n\r\nand by changing the matching block a bit:\r\n```\r\nfor (String cpu : ExecutingCommand.runNative(\"psrinfo -pv\")) {\r\n    Matcher m = PSRINFO.matcher(cpu.trim());\r\n    if (m.matches()) {\r\n        this.physicalProcessorCount = Integer.parseInt(m.group(1));\r\n        this.logicalProcessorCount = Integer.parseInt(m.group(2));\r\n    }\r\n}\r\n```\r\n\r\nDo you have a different output of the psrinfo command on other versions of Solaris ?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/oshi/oshi/issues/comments/388411679","html_url":"https://github.com/oshi/oshi/issues/488#issuecomment-388411679","issue_url":"https://api.github.com/repos/oshi/oshi/issues/488","id":388411679,"user":{"login":"Kald0","id":36925371,"avatar_url":"https://avatars2.githubusercontent.com/u/36925371?v=4","gravatar_id":"","url":"https://api.github.com/users/Kald0","html_url":"https://github.com/Kald0","followers_url":"https://api.github.com/users/Kald0/followers","following_url":"https://api.github.com/users/Kald0/following{/other_user}","gists_url":"https://api.github.com/users/Kald0/gists{/gist_id}","starred_url":"https://api.github.com/users/Kald0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kald0/subscriptions","organizations_url":"https://api.github.com/users/Kald0/orgs","repos_url":"https://api.github.com/users/Kald0/repos","events_url":"https://api.github.com/users/Kald0/events{/privacy}","received_events_url":"https://api.github.com/users/Kald0/received_events","type":"User","site_admin":false},"created_at":"2018-05-11T16:16:22Z","updated_at":"2018-05-11T16:16:22Z","author_association":"NONE","body":"Thanks for your feedback, I'll try to work on that early next week :-)"}}
{"actor":{"display_login":"Kald0"}}