⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 counters.mx

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MX
📖 第 1 页 / 共 5 页
字号:
@' 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-2007 CWI.@' All Rights Reserved.@f counters@a S. Manegold, P. Boncz@+ Performance CountersThis is a memory/cpu performance measurement tool forthe following processor (families).@itemize@item MIPS R10000/R12000 (IP27) @item Sun UltraSparcI/II (sun4u)@item Intel Pentium (i586/P5) @item Intel PentiumPro/PentiumII/PentiumIII/Celeron (i686/P6)@item AMD Athlon (i686/K7)@item Intel Itanium/Itanium2 (ia64) @end itemizeIt uses@itemize@item @url{http://www.cse.msu.edu/~enbody/perfmon.html,libperfmon } libperfex (IRIX) for R10000/R12000,@item (Solaris <= 7) by Richard Enbody, libcpc (Solaris >= 8) for UltraSparcI/II,@item @[<a href="http://qso.lanl.gov/~mpg/pperf.html"> libpperf </a>@(Linux-i?86 <= 2.2), by M. Patrick Goda and Michael S. Warren,@item @url{http://www.csd.uu.se/~mikpe/linux/perfctr/,libperfctr} (Linux-i?86 >= 2.4), by M. Pettersson for Pentiums \& Athlons.@item @url{http://www.hpl.hp.com/research/linux/perfmon/, libpfm} (Linux-ia64 >= 2.4), by HP for Itanium[2].@end itemizeModule counters provides similar interface and facilities as Peter'sR10000 perfex module, but it offers no multiplexing of several events;only two events can be monitored at a time.On non-Linux/x86, non-Solaris/UltraSparc, and non-IRIX/R1x000 systems,only the elapsed time in microseconds is measured.@{@+ Module DefinitionThe major difference with the M4 library is that it does notexpose the counter structure to the language level.This is possible, because the M4 scheme for their decompositionright now is limited to turn it into a BAT or string.Instead an integer handle is return to designate a counter.We provide some BAT views over the counter table@malmodule counters;command start(event0:int, event1:int) :intaddress CNTRSstart comment "Start counters for two events specified by number. Return its handle";command reset(idx:int, event0:int, event1:int) :intaddress CNTRSreset comment "Reset a counter for two events specified by number. Return its handle";command stop(c:int) :voidaddress CNTRSstop comment "Stop the counting for the handle identified";command bat(c:int) :bat[:str,:lng] address CNTRScounter2batcomment "Store the retrieved results in a BAT";command str(c:int) :straddress CNTRScounter2strcomment "Store the retrieved results in a str";command nativeEvents() :bat[:int,:str] address CNTRSnativeEventscomment "All available events";command unifiedEvents() :bat[:int,:str] address CNTRSunifiedEventscomment "All unified event names";command eventNumber(s:str):intaddress CNTRSeventNumbercomment "Return the number of an event given by name ";command eventName(s:int):straddress CNTRSeventNamecomment "Return the name of an event ";command init() address CNTRSinitcomment "Initialize counters module (to be used on initial load, only)";counters.init();@mil@+ Implementation@h#include "gdk.h"typedef struct {	lng status;		/* counter status */	lng generation;		/* IRIX                 : counter id				   SunOS      + Perfmon : file descriptor				   Linux-i?86 + Perfctr : struct vperfctr*				   Linux-ia64 + Pfm     : pfmInfo_t*				 */	lng usec;		/* microseconds of elapsed time */	lng clocks;		/* elapsed clock ticks */	lng event0;		/* event counters */	lng count0;	lng event1;	lng count1;} counter;@c#include "mal_config.h"#include "counters.h"#include "errno.h"#ifdef WIN32#ifndef LIBCOUNTERS#define counters_export extern __declspec(dllimport)#else#define counters_export extern __declspec(dllexport)#endif#else#define counters_export extern#endifint NumEvents = 0, NoEvent = 0;#if defined(HWCOUNTERS)#if defined(HW_SunOS)#if   defined(HAVE_LIBPERFMON)	/* libperfmon (on Solaris <= 7) */#define LIB_SunOS(a,b) a#elif defined(HAVE_LIBCPC)	/* libcpc     (on Solaris >= 8) */#define LIB_SunOS(a,b) b#endif#endiftypedef struct {	int id0;		/* event id for counter 0 */	int id1;		/* event id for counter 1 */	str unified;		/* unified event name */	str native;		/* native event name */#if ( defined(HW_Linux) && ( defined(HW_i568) || defined(HW_i686) || defined(HW_x86_64) ) )	int code;		/* event code */	int mask;		/* unit mask for "fine-tuning" of some events */#endif#if defined(HW_SunOS)	 LIB_SunOS(int bits;	/* event code for perfmon on Solaris <= 7 */		   , char *spec;	/* event spec for libcpc  on Solaris >= 8 */	    )#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -