update to tmux-mem-cpu-load-3.4.0

This commit is contained in:
jasper 2016-08-10 14:09:39 +00:00
parent fe52d93e5d
commit 14604912ec
3 changed files with 5 additions and 64 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.10 2016/04/29 09:33:10 jasper Exp $
# $OpenBSD: Makefile,v 1.11 2016/08/10 14:09:39 jasper Exp $
COMMENT = CPU, RAM memory, and load monitor for use with tmux(1)
GH_ACCOUNT = thewtex
GH_PROJECT = tmux-mem-cpu-load
GH_TAGNAME = v3.3.0
GH_TAGNAME = v3.4.0
CATEGORIES = sysutils
@ -23,7 +23,7 @@ MODGCC4_LANGS = c++
MODCLANG_ARCHS = amd64 i386
MODCLANG_LANGS = c++
WANTLIB += c m stdc++
WANTLIB += c m
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/tmux-mem-cpu-load/

View File

@ -1,2 +1,2 @@
SHA256 (tmux-mem-cpu-load-3.3.0.tar.gz) = Ujxpqr0wQQW219t/lfp7UHFXlK9uAAoPcFzlMwJq+Xc=
SIZE (tmux-mem-cpu-load-3.3.0.tar.gz) = 17835
SHA256 (tmux-mem-cpu-load-3.4.0.tar.gz) = p3OZThYIEqlkq8f8To7Ba32YM+2wpm5cZ/KHx8WUnss=
SIZE (tmux-mem-cpu-load-3.4.0.tar.gz) = 19483

View File

@ -1,59 +0,0 @@
$OpenBSD: patch-openbsd_memory_cc,v 1.2 2016/04/29 09:33:10 jasper Exp $
Simplify memory calculations by using uvmexp.pageshift
--- openbsd/memory.cc.orig Mon Mar 7 02:33:34 2016
+++ openbsd/memory.cc Fri Apr 29 11:31:48 2016
@@ -39,13 +39,6 @@
#include "memory.h"
#include "conversions.h"
-static int pageshift;
-
-#ifndef LOG1024
-#define LOG1024 10
-#endif
-#define pagesh(size) ((size) << pageshift)
-
void mem_status( MemoryStatus & status )
{
// These values are in bytes
@@ -63,16 +56,6 @@ void mem_status( MemoryStatus & status )
error( "memory: error getting page size" );
}
- // calculate how far we must shift the variables
- pageshift = 0;
- while( page_size > 1 )
- {
- pageshift++;
- page_size >>= 1;
- }
-
- pageshift -= LOG1024;
-
// get vm memory stats
static int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
struct uvmexp uvmexp;
@@ -92,16 +75,15 @@ void mem_status( MemoryStatus & status )
}
// calculations based on libgtop
- used_mem = (uint64_t) pagesh (uvmexp.npages - uvmexp.free) << LOG1024;
+ used_mem = ( (uint64_t) uvmexp.npages - uvmexp.free ) << uvmexp.pageshift;
+ free_mem = ( (uint64_t) uvmexp.free ) << uvmexp.pageshift;
- free_mem = (uint64_t) pagesh( uvmexp.free ) << LOG1024;
-
// from nagios-memory plugin
- used_mem -= pagesh( bcstats.numbufpages );
- free_mem += pagesh( bcstats.numbufpages );
+ used_mem -= ( (uint64_t) bcstats.numbufpages ) << uvmexp.pageshift;
+ free_mem += ( (uint64_t) bcstats.numbufpages ) << uvmexp.pageshift;
// calculate total memory
- total_mem = (uint64_t) pagesh( uvmexp.npages ) << LOG1024;
+ total_mem = ( (uint64_t) uvmexp.npages ) << uvmexp.pageshift;
status.used_mem = convert_unit(static_cast< float >( used_mem ), MEGABYTES );
status.total_mem = convert_unit(static_cast< float >( total_mem ), MEGABYTES );