summaryrefslogtreecommitdiff
path: root/sysutils/tmux-mem-cpu-load
diff options
context:
space:
mode:
authorAdam Weinberger <adamw@FreeBSD.org>2019-12-22 18:54:47 +0000
committerAdam Weinberger <adamw@FreeBSD.org>2019-12-22 18:54:47 +0000
commitaf6855fdadee9e0b9c5973fb3259aee34a13f2a1 (patch)
tree23fe8c9abe244f4c8b8fa7a5a0c010c6582011da /sysutils/tmux-mem-cpu-load
parentscience/agrum: fix build on powerpc64 elfv2 (diff)
tmux-mem-cpu-load: Fix memory calculation, and remove tmux dependency
This adds a patch from fluffy that fixes the memory usage calculation, which was previously wildly incorrect (on my box: before 484, after 16889). See https://github.com/thewtex/tmux-mem-cpu-load/pull/61 Also, I'm removing the run-time dependency on tmux. Although this program is designed to be used in the tmux status bar, there's no reason it can't be used in any other status bar, and it doesn't actually use tmux in any way.
Notes
Notes: svn path=/head/; revision=520651
Diffstat (limited to 'sysutils/tmux-mem-cpu-load')
-rw-r--r--sysutils/tmux-mem-cpu-load/Makefile4
-rw-r--r--sysutils/tmux-mem-cpu-load/files/patch-freebsd_memory.cc24
2 files changed, 25 insertions, 3 deletions
diff --git a/sysutils/tmux-mem-cpu-load/Makefile b/sysutils/tmux-mem-cpu-load/Makefile
index 07b2fc176525..ded0c1afdeb5 100644
--- a/sysutils/tmux-mem-cpu-load/Makefile
+++ b/sysutils/tmux-mem-cpu-load/Makefile
@@ -3,7 +3,7 @@
PORTNAME= tmux-mem-cpu-load
PORTVERSION= 3.4.0
-PORTREVISION= 3
+PORTREVISION= 4
DISTVERSIONPREFIX= v
CATEGORIES= sysutils
@@ -12,8 +12,6 @@ COMMENT= CPU, RAM, and load monitor for use with tmux
LICENSE= APACHE20
-RUN_DEPENDS= tmux:sysutils/tmux
-
USES= cmake compiler:c++11-lang
USE_GITHUB= yes
GH_ACCOUNT= thewtex
diff --git a/sysutils/tmux-mem-cpu-load/files/patch-freebsd_memory.cc b/sysutils/tmux-mem-cpu-load/files/patch-freebsd_memory.cc
new file mode 100644
index 000000000000..d6c2344c9274
--- /dev/null
+++ b/sysutils/tmux-mem-cpu-load/files/patch-freebsd_memory.cc
@@ -0,0 +1,24 @@
+From e24890652e3674fe4677722aab8644e62da37348 Mon Sep 17 00:00:00 2001
+From: Dima Panov <fluffy@FreeBSD.org>
+Date: Fri, 20 Dec 2019 02:47:32 +1000
+Subject: [PATCH] Fix calculate memory usage on FreeBSD
+
+---
+ freebsd/memory.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/freebsd/memory.cc b/freebsd/memory.cc
+index 5500032..687a0a8 100644
+--- freebsd/memory.cc
++++ freebsd/memory.cc
+@@ -63,8 +63,8 @@ void mem_status( MemoryStatus & status )
+ //u_int unused = ( cache + inactive + free ) * page_size;
+
+ // Used memory on FreeBSD is active + wired.
+- u_int used = ( active + wired ) * page_size;
++ u_int used = ( active + wired );
+
+- status.used_mem = convert_unit( static_cast< float >( used ), MEGABYTES );
++ status.used_mem = convert_unit( static_cast< float >( used * (page_size >> 10) ), MEGABYTES, KILOBYTES );
+ status.total_mem = convert_unit( static_cast< float >( page_count * (page_size >> 10) ), MEGABYTES, KILOBYTES);
+ }