diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-26 14:38:46 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-26 14:38:46 +0200 |
| commit | 93b965c5ab96b81f71bc64e3b43097e4a8f97b96 (patch) | |
| tree | 569c04645c12d89d9ed198c4e756a2054c3151c3 /src | |
| parent | 5aa080b9695e341784272268bf90927914f1ce7a (diff) | |
| parent | 2bddf88c8ee0b247e105d32371b74c769e16043c (diff) | |
| download | rabbitmq-server-git-93b965c5ab96b81f71bc64e3b43097e4a8f97b96.tar.gz | |
Merge branch 'stable'
Diffstat (limited to 'src')
| -rw-r--r-- | src/term_to_binary_compat.erl | 1 | ||||
| -rw-r--r-- | src/vm_memory_monitor.erl | 10 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/term_to_binary_compat.erl b/src/term_to_binary_compat.erl index 13396ddacb..b5e8f72bd4 100644 --- a/src/term_to_binary_compat.erl +++ b/src/term_to_binary_compat.erl @@ -22,4 +22,3 @@ term_to_binary_1(Term) -> term_to_binary(Term, [{minor_version, 1}]). - diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index f21dc91e0a..b07ff27f17 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -189,14 +189,12 @@ get_system_process_resident_memory({unix,openbsd}) -> get_system_process_resident_memory({win32,_OSname}) -> OsPid = os:getpid(), - Cmd = " tasklist /fi \"pid eq " ++ OsPid ++ "\" /fo LIST 2>&1 ", + Cmd = "wmic process where processid=" ++ OsPid ++ " get WorkingSetSize /value 2>&1", CmdOutput = os:cmd(Cmd), - %% Memory usage is displayed in kilobytes - %% with comma-separated thousands - case re:run(CmdOutput, "Mem Usage:\\s+([0-9,]+)\\s+K", [{capture, all_but_first, list}]) of + %% Memory usage is displayed in bytes + case re:run(CmdOutput, "WorkingSetSize=([0-9]+)", [{capture, all_but_first, binary}]) of {match, [Match]} -> - NoCommas = [ N || N <- Match, N =/= $, ], - {ok, list_to_integer(NoCommas) * 1024}; + {ok, binary_to_integer(Match)}; _ -> {error, {unexpected_output_from_command, Cmd, CmdOutput}} end; |
