Changeset: 65ae521acf29 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65ae521acf29 Modified Files: monetdb5/modules/kernel/status.mx Branch: headless Log Message:
Remove old stuff diffs (truncated from 683 to 300 lines): diff --git a/monetdb5/modules/kernel/status.mx b/monetdb5/modules/kernel/status.mx deleted file mode 100644 --- a/monetdb5/modules/kernel/status.mx +++ /dev/null @@ -1,678 +0,0 @@ -@/ -The contents of this file are subject to the MonetDB Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is the MonetDB Database System. - -The Initial Developer of the Original Code is CWI. -Portions created by CWI are Copyright (C) 1997-July 2008 CWI. -Copyright August 2008-2011 MonetDB B.V. -All Rights Reserved. -@ - -@f status -@a M.L. Kersten, P. Boncz, N.Nes -@v 2.0 -@+ System state information -This document introduces a series of bats and operations that provide access -to information stored within the Monet Version 5 internal data structures. -In all cases, pseudo BAT operation returns a transient BAT that -should be garbage collected after being used. - -The main performance drain would be to use a pseudo BAT directly to -successively access it components. This can be avoided by first assigning -the pseudo BAT to a variable. -@{ -@mal -module status; - -command cpuStatistics() (lo:col[:str],ro:col[:int] ) -address SYScpuStatistics -comment "Global cpu usage information"; -command memStatistics() (lo:col[:str], ro:col[:wrd] ) -address SYSmemStatistics -comment "Global memory usage information"; -command ioStatistics() (lo:col[:str],ro:col[:int] ) -address SYSioStatistics -comment "Global IO activity information"; -command vmStatistics(minsize:lng) (lo:col[:str],ro:col[:lng] ) -address SYSvm_usage -comment "Get a split-up of how much virtual memory blocks are in use"; -command memUsage(minsize:lng)(lo:col[:str],ro:col[:lng] ) -address SYSmem_usage -comment "Get a split-up of how much memory blocks are in use"; -@- -Some explanation of what mem_usage() and vm_usage() display: -@verbatim -> m:= status.memUsage(1024:lng); io.print(m); -#------------------------------# -# BAT: tmp_42 # -# (str) (lng) # -#------------------------------# -[ "buns/car_category", 400012 ] 100.000 string offsets -[ "buns/car_town", 400012 ] idem -[ "buns/car_class", 400012 ] idem -[ "tail/car_category", 266244 ] string tail heap -[ "tail/car_town", 266244 ] idem -[ "tail/car_class", 266244 ] idem -[ "_tot/buns", 1322996 ] the three bun heaps -[ "_tot/tail", 967762 ] the three tail heaps -[ "_tot/head", 70984 ] negligable -[ "_tot/cbp", 98866 ] CBP metadata structure -[ "_tot/mil", 102400 ] MIL interpreter stack space -[ "_tot/found", 2590144 ] buns+head+tail+bbp+mil -[ "_tot/malloc_heap", 2956048 ] in malloc heap -[ "_tot/malloc", 2956048 ] total consumed via malloc -[ "_tot/valloc", 201266 ] total consumed via virtualalloc -[ "_tot/mem", 3157314 ] total RAM+swap-file consumption - -> -> v:= status.vmStatistics(1024:lng); io.print(v); -#------------------------------# -# BAT: tmp_42 # -# (str) (lng) # -#------------------------------# -[ "_tot/bbp", 50331648 ] 50MB reserved (100KB claimed) -[ "_tot/mil", 16777216 ] 16MB reserved (100KB claimed) -[ "_tot/found", 67108864 ] bbp+mil -[ "_tot/vm", 71244560 ] total address space consumption -> -@end verbatim -@+ MAL runtime status -@mal -command batStatistics()(lo:col[:str],ro:col[:str] ) -address SYSgdkEnv -comment "Show distribution of bats by kind"; -command getThreads()(lo:col[:int],ro:col[:str]) -address SYSgdkThread -comment "Produce overview of active threads"; - -command mem_cursize():lng -address SYSgetmem_cursize -comment "The amount of physical swapspace in KB that is currently in use"; - -command mem_maxsize():lng -address SYSgetmem_maxsize -comment "The maximum usable amount of physical swapspace in KB (target only)"; - -command mem_maxsize(v:lng):void -address SYSsetmem_maxsize -comment "Set the maximum usable amount of physical swapspace in KB"; - -command vm_cursize():lng -address SYSgetvm_cursize -comment "The amount of logical VM space in KB that is currently in use"; - -command vm_maxsize():lng -address SYSgetvm_maxsize -comment "The maximum usable amount of logical VM space in KB (target only)"; - -command vm_maxsize(v:lng):void -address SYSsetvm_maxsize -comment "Set the maximum usable amount of physical swapspace in KB"; - -@+ Implementation Code -@h -#ifndef _SYS_H_ -#define _SYS_H_ - -#ifdef WIN32 -#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && !defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && !defined(LIBMONETDB5) -#define status_export extern __declspec(dllimport) -#else -#define status_export extern __declspec(dllexport) -#endif -#else -#define status_export extern -#endif - - -#endif -@- - -@include kprelude.mx -@c -#include "monetdb_config.h" -#include "gdk.h" -#include <stdarg.h> -#include <time.h> -#include "mal_exception.h" -#include "status.h" -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif - -#ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif - -#ifdef HAVE_SYS_RESOURCE_H -# include <sys/resource.h> -#endif - -@h -status_export str SYSgetmem_cursize(lng *num); -@c -str -SYSgetmem_cursize(lng *num) -{ - *num = GDKmem_cursize(); - return MAL_SUCCEED; -} - -@h -status_export str SYSgetmem_maxsize(lng *num); -@c -str -SYSgetmem_maxsize(lng *num) -{ - *num = GDK_mem_maxsize; - return MAL_SUCCEED; -} - -@h -status_export str SYSsetmem_maxsize(int *ret, lng *num); -@c -str -SYSsetmem_maxsize(int *ret, lng *num) -{ - size_t sze = 0; - *ret = 0; - if (*num < 0) - throw(ILLARG, "status.mem_maxsize", "new size must not be < 0"); -#if SIZEOF_SIZE_T == SIZEOF_INT - { - lng size_t_max = 2 * (lng)INT_MAX; - if (*num > size_t_max) - throw(ILLARG, "status.mem_maxsize", "new size must not be > " LLFMT, size_t_max); - } -#endif - if (sze < GDK_mem_bigsize) - GDK_mem_bigsize = MAX(32768, sze); - GDK_mem_maxsize = MAX(GDK_mem_bigsize, sze); - return MAL_SUCCEED; -} - -@h -status_export str SYSgetvm_cursize(lng *num); -@c -str -SYSgetvm_cursize(lng *num) -{ - *num = GDKvm_cursize(); - return MAL_SUCCEED; -} - -@h -status_export str SYSgetvm_maxsize(lng *num); -@c -str -SYSgetvm_maxsize(lng *num) -{ - *num = GDK_vm_maxsize; - return MAL_SUCCEED; -} - -@h -status_export str SYSsetvm_maxsize(lng *num); -@c -str -SYSsetvm_maxsize(lng *num) -{ - GDK_vm_maxsize = (size_t) *num; - return MAL_SUCCEED; -} - -@- Performance -To obtain a good impression of the Monet performance we need timing information. -The most detailed information is best obtained with the system profiler. - -However, the direct approach is to enable the user to read the timers maintained -internally. This is done with the CPU, IO, MEMORY, and CBP command which -displays the elapsed time in seconds, user- and system-cpu time in milliseconds -since its last invocation and the amount of space in use. The process -identifier is used to differentiate among the possible processes. - -Note that in multi threaded mode the routine prints the elapsed -time since the beginning of each process. -@c -#ifdef HAVE_TIMES -static time_t clk = 0; -static struct tms state; -#endif - -@h -status_export str SYScpuStatistics(int *ret); -@c -str -SYScpuStatistics(int *ret) -{ - int i; - BAT *b; -#ifdef HAVE_TIMES - struct tms newst; -# ifndef HZ - static int HZ; - - if (HZ == 0) { -# if defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK) - HZ = sysconf(_SC_CLK_TCK); -# else - HZ = CLK_TCK; -# endif - } -# endif -#endif - - b = BATnew(TYPE_str, TYPE_int, 32); - if (b == 0) - throw(MAL, "status.cpuStatistics", MAL_MALLOC_FAIL); -#ifdef HAVE_TIMES - if (clk == 0) { - clk = time(0); - times(&state); - } - times(&newst); - /* store counters, ignore errors */ - i = (int) (time(0) - clk); - b = BUNins(b, "elapsed", &i, FALSE); - i = newst.tms_utime * 1000 / HZ; - b = BUNins(b, "user", &i, FALSE); - i = (newst.tms_utime - state.tms_utime) * 1000 / HZ; - b = BUNins(b, "elapuser", &i, FALSE); - i = newst.tms_stime * 1000 / HZ; - b = BUNins(b, "system", &i, FALSE); - i = (newst.tms_stime - state.tms_stime) * 1000 / HZ; - b = BUNins(b, "elapsystem", &i, FALSE); - - state = newst; _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
