From sean at seanoneill.info Tue Jun 1 13:13:27 2004 From: sean at seanoneill.info (sean at seanoneill.info) Date: Tue, 1 Jun 2004 13:13:27 -0700 Subject: [Orca-checkins] r332 - in trunk/orca: data_gatherers/orcallator lib/SE/3.2.1 lib/SE/3.3 lib/SE/3.3.1 Message-ID: <200406012013.i51KDRuB028794@orcaware.com> Author: sean at seanoneill.info Date: Tue Jun 1 13:11:29 2004 New Revision: 332 Added: trunk/orca/lib/SE/3.2.1/orca_p_netstat_class.se trunk/orca/lib/SE/3.3.1/orca_p_netstat_class.se trunk/orca/lib/SE/3.3/orca_p_netstat_class.se Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in trunk/orca/data_gatherers/orcallator/orcallator.se Log: * ADDED the following files: lib/SE/3.2.1/orca_p_netstat_class.se lib/SE/3.3.1/orca_p_netstat_class.se lib/SE/3.3/orca_p_netstat_class.se The RICHPse package file p_netstat_class.se file was modified to compute the TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead. The modified file was copied into the lib/SE/ specific directories for orca.pl to include at runtime. Name changed to orca_p_netstat_class.se to match currert naming convention. * data_gatherers/orcallator/orcallator.cfg.in Modified to create the graphs for TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead. * data_gatherers/orcallator/orcallator.se Modified to import new orca_p_netstat_class.se include file. Also added code to collect TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead data. Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.cfg.in (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.cfg.in Tue Jun 1 13:11:29 2004 @@ -437,6 +437,34 @@ } plot { +title %g Interface In/Out Packet Data Payload Size: $1 +source orcallator +data (.*\d+)InDtSz/p +data $1OuDtSz/p +line_type area +line_type line1 +legend Input +legend Output +y_legend Data Bytes/packet +data_min 0 +data_max 1540 +} + +plot { +title %g Interface In/Out Packet Header Overhead: $1 +source orcallator +data (.*\d+)InOvH%/p +data $1OuOvH%/p +line_type area +line_type line1 +legend Input +legend Output +y_legend % Pkt Hdr Overhead/packet +data_min 0 +data_max 100 +} + +plot { title %g TCP Bits Per Second source orcallator data 1024 * 8 * tcp_InKB/s @@ -482,6 +510,34 @@ } plot { +title %g TCP In/Out Packet Data Payload Size +source orcallator +data tcp_InDtSz/p +data tcp_OuDtSz/p +line_type area +line_type line1 +legend Input +legend Output +y_legend Data Bytes/packet +data_min 0 +data_max 1540 +} + +plot { +title %g TCP In/Out Packet Header Overhead +source orcallator +data tcp_InOvH%/p +data tcp_OuOvH%/p +line_type area +line_type line1 +legend Input +legend Output +y_legend % Pkt Hdr Overhead/packet +data_min 0 +data_max 100 +} + +plot { title %g TCP New Connection Rate source orcallator data tcp_Icn/s Modified: trunk/orca/data_gatherers/orcallator/orcallator.se ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.se (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.se Tue Jun 1 13:11:29 2004 @@ -65,7 +65,8 @@ #include #include -#include +//#include +#include //#include #include #include @@ -1344,8 +1345,16 @@ sprintf("%11.3f", GLOBAL_net[i].opackets)); put_output(sprintf("%5sInKB/s", tmp_lr_net.names[i]), sprintf("%11.3f", GLOBAL_net[i].ioctets/1024.0)); + put_output(sprintf("%5sInDtSz/p", tmp_lr_net.names[i]), + sprintf("%11.3f", GLOBAL_net[i].idtsize)); + put_output(sprintf("%5sInOvH%%/p", tmp_lr_net.names[i]), + sprintf("%11.3f", GLOBAL_net[i].ihdrovhd)); put_output(sprintf("%5sOuKB/s", tmp_lr_net.names[i]), sprintf("%11.3f", GLOBAL_net[i].ooctets/1024.0)); + put_output(sprintf("%5sOuDtSz/p", tmp_lr_net.names[i]), + sprintf("%11.3f", GLOBAL_net[i].odtsize)); + put_output(sprintf("%5sOuOvH%%/p", tmp_lr_net.names[i]), + sprintf("%11.3f", GLOBAL_net[i].ohdrovhd)); put_output(sprintf("%5sIErr/s", tmp_lr_net.names[i]), sprintf("%11.3f", GLOBAL_net[i].ierrors)); put_output(sprintf("%5sOErr/s", tmp_lr_net.names[i]), @@ -1369,10 +1378,33 @@ #ifdef WATCH_TCP measure_tcp() { + double tmp_tcp_InDtpPkt; + double tmp_tcp_OuDtpPkt; + double tmp_tcp_InOvHPct; + double tmp_tcp_OuOvHPct; + put_output("tcp_Iseg/s", sprintf("%10.3f", tmp_tcp.InDataSegs)); put_output("tcp_Oseg/s", sprintf("%10.3f", tmp_tcp.OutDataSegs)); put_output("tcp_InKB/s", sprintf("%10.3f", tmp_tcp.InDataBytes/1024.0)); put_output("tcp_OuKB/s", sprintf("%10.3f", tmp_tcp.OutDataBytes/1024.0)); + if ( tmp_tcp.InDataSegs == 0.0 ) { + tmp_tcp_InDtpPkt = 0.0; + tmp_tcp_InOvHPct = 0.0; + } else { + tmp_tcp_InDtpPkt = tmp_tcp.InDataBytes/tmp_tcp.InDataSegs; + tmp_tcp_InOvHPct = 100 * (40 * tmp_tcp.InDataSegs / (40 * tmp_tcp.InDataSegs + tmp_tcp.InDataBytes)); + } + put_output("tcp_InDtSz/p", sprintf("%10.3f", tmp_tcp_InDtpPkt)); + put_output("tcp_InOvH%/p", sprintf("%8.3f", tmp_tcp_InOvHPct)); + if ( tmp_tcp.OutDataSegs == 0.0 ) { + tmp_tcp_OuDtpPkt = 0.0; + tmp_tcp_OuOvHPct = 0.0; + } else { + tmp_tcp_OuDtpPkt = tmp_tcp.OutDataBytes/tmp_tcp.OutDataSegs; + tmp_tcp_OuOvHPct = 100 * (40 * tmp_tcp.OutDataSegs / (40 * tmp_tcp.OutDataSegs + tmp_tcp.OutDataBytes)); + } + put_output("tcp_OuDtSz/p", sprintf("%10.3f", tmp_tcp_OuDtpPkt)); + put_output("tcp_OuOvH%/p", sprintf("%8.3f", tmp_tcp_OuOvHPct)); put_output("tcp_Ret%", sprintf("%8.3f", tmp_tcp.RetransPercent)); put_output("tcp_Dup%", sprintf("%8.3f", tmp_tcp.InDupPercent)); put_output("tcp_Icn/s", sprintf("%9.3f", tmp_tcp.PassiveOpens)); Added: trunk/orca/lib/SE/3.2.1/orca_p_netstat_class.se ============================================================================== --- (empty file) +++ trunk/orca/lib/SE/3.2.1/orca_p_netstat_class.se Tue Jun 1 13:11:29 2004 @@ -0,0 +1,247 @@ +// +// Copyright (c) 1993-2001 by Richard Pettit. All rights reserved. +// +// Some of this work was derived from include files containing the following +// copyrights. +// +// Copyright (c) 1986-1994 by Sun Microsystems, Inc. +// Copyright (c) 1983-1989 by AT&T +// Copyright (c) 1980-1993 by The Regents of the University of California. +// +// The work as a whole represents unique intellectual property and is +// copyright by Richard Pettit as shown on the first line. +// + +#ifndef _P_NETSTAT_CLASS_SE_ +#define _P_NETSTAT_CLASS_SE_ + +#include +#include +#include +#include +#include +#include + +#define NANODOUBLE 0.000000001 /* converts gethrtime to seconds */ + +/* robust difference generator for wrapping 32bit counters */ +/* unsigned to double difference */ + +#define UD_DIFF(now, then) (((double) now) >= ((double) then) ? \ + (now - then) : \ + ((double) now) + 4294967296.0 - ((double) then)) + +// All this crap must be global 'cause I can't fix the interpreter bug. + +double pnetGLOB_net_ipackets[]; /* these are rates */ +double pnetGLOB_net_idtsize[]; +double pnetGLOB_net_ihdrovhd[]; +double pnetGLOB_net_ierrors[]; +double pnetGLOB_net_opackets[]; +double pnetGLOB_net_odtsize[]; +double pnetGLOB_net_ohdrovhd[]; +double pnetGLOB_net_oerrors[]; +double pnetGLOB_net_collisions[]; +double pnetGLOB_net_defer[]; +double pnetGLOB_net_nocanput[]; +double pnetGLOB_net_ioctets[]; +double pnetGLOB_net_ooctets[]; +netif pnetGLOB_save_nets[]; /* these are absolute values */ +double pnetGLOB_save_et[]; + +int pnetGLOB_net_size = MAX_IF; + +pnetGLOB_realloc() +{ + pnetGLOB_net_ipackets = renew pnetGLOB_net_ipackets[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = renew pnetGLOB_net_idtsize[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = renew pnetGLOB_net_ihdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = renew pnetGLOB_net_ierrors[pnetGLOB_net_size]; + pnetGLOB_net_opackets = renew pnetGLOB_net_opackets[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = renew pnetGLOB_net_odtsize[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = renew pnetGLOB_net_ohdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = renew pnetGLOB_net_oerrors[pnetGLOB_net_size]; + pnetGLOB_net_collisions = renew pnetGLOB_net_collisions[pnetGLOB_net_size]; + pnetGLOB_net_defer = renew pnetGLOB_net_defer[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = renew pnetGLOB_net_nocanput[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = renew pnetGLOB_net_ioctets[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = renew pnetGLOB_net_ooctets[pnetGLOB_net_size]; + pnetGLOB_save_nets = renew pnetGLOB_save_nets[pnetGLOB_net_size]; + pnetGLOB_save_et = renew pnetGLOB_save_et[pnetGLOB_net_size]; +} + +class p_netstat { + + int number$; + char name$[12]; + + int net_count; + double ipackets; + double ierrors; + double idtsize; + double ihdrovhd; + double opackets; + double oerrors; + double odtsize; + double ohdrovhd; + double collisions; + double collpercent; + double nocanput; + double defer; + double ioctets; + double ooctets; + ulong_t ifspeed; + int iftype; + double utilization; + + p_netstat$() + { + int i; + int initialized = 0; + netif interface; + double et; + double now; + + /* do initialization code */ + if (initialized == 0) { + + pnetGLOB_net_ipackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_opackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_collisions = new double[pnetGLOB_net_size]; + pnetGLOB_net_defer = new double[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = new double[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = new double[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = new double[pnetGLOB_net_size]; + pnetGLOB_save_nets = new netif[pnetGLOB_net_size]; + pnetGLOB_save_et = new double[pnetGLOB_net_size]; + + /* grab initial info from netif class */ + for(refresh$(interface), i=0; i= net_count)) { + number$ = -1; + return; + } + + /* find out how many seconds have elapsed */ + now = gethrtime() * NANODOUBLE; + et = (now - pnetGLOB_save_et[i]); + + /* do computes if at least a second has gone by */ + if (et > 1.0) { + /* save the time */ + pnetGLOB_save_et[i] = now; + + /* grab the info for this net */ + interface.number$ = i; + refresh$(interface); + + /* compute new values */ + pnetGLOB_net_ipackets[i] = + UD_DIFF(interface.ipackets, pnetGLOB_save_nets[i].ipackets) / et; + pnetGLOB_net_ierrors[i] = + UD_DIFF(interface.ierrors, pnetGLOB_save_nets[i].ierrors) / et; + pnetGLOB_net_opackets[i] = + UD_DIFF(interface.opackets, pnetGLOB_save_nets[i].opackets) / et; + pnetGLOB_net_oerrors[i] = + UD_DIFF(interface.oerrors, pnetGLOB_save_nets[i].oerrors) / et; + pnetGLOB_net_collisions[i] = + UD_DIFF(interface.collisions, pnetGLOB_save_nets[i].collisions) / et; + pnetGLOB_net_nocanput[i] = + UD_DIFF(interface.nocanput, pnetGLOB_save_nets[i].nocanput) / et; + pnetGLOB_net_defer[i] = + UD_DIFF(interface.defer, pnetGLOB_save_nets[i].defer) / et; + pnetGLOB_net_ioctets[i] = + UD_DIFF(interface.ioctets, pnetGLOB_save_nets[i].ioctets) / et; + pnetGLOB_net_ooctets[i] = + UD_DIFF(interface.ooctets, pnetGLOB_save_nets[i].ooctets) / et; + if ( pnetGLOB_net_ipackets[i] == 0.0 ) { + pnetGLOB_net_idtsize[i] = 0.0; + pnetGLOB_net_ihdrovhd[i] = 0.0; + } else { + pnetGLOB_net_idtsize[i] = pnetGLOB_net_ioctets[i] / pnetGLOB_net_ipackets[i]; + pnetGLOB_net_ihdrovhd[i] = 100 * (40 * pnetGLOB_net_ipackets[i] / ( 40 * pnetGLOB_net_ipackets[i] + pnetGLOB_net_ioctets[i] )); + } + if ( pnetGLOB_net_opackets[i] == 0.0 ) { + pnetGLOB_net_odtsize[i] = 0.0; + pnetGLOB_net_ohdrovhd[i] = 0.0; + } else { + pnetGLOB_net_odtsize[i] = pnetGLOB_net_ooctets[i] / pnetGLOB_net_opackets[i]; + pnetGLOB_net_ohdrovhd[i] = 100 * (40 * pnetGLOB_net_opackets[i] / ( 40 * pnetGLOB_net_opackets[i] + pnetGLOB_net_ooctets[i] )); + } + /* save old */ + pnetGLOB_save_nets[i] = interface; + } + + /* update and return */ + strncpy(name$, pnetGLOB_save_nets[i].name$, 12); + ipackets = pnetGLOB_net_ipackets[i]; + ierrors = pnetGLOB_net_ierrors[i]; + opackets = pnetGLOB_net_opackets[i]; + oerrors = pnetGLOB_net_oerrors[i]; + collisions = pnetGLOB_net_collisions[i]; + if (opackets > 0.0) { + collpercent = collisions * 100.0 / opackets; + } else { + collpercent = 0.0; + } + nocanput = pnetGLOB_net_nocanput[i]; + defer = pnetGLOB_net_defer[i]; + ioctets = pnetGLOB_net_ioctets[i]; + ooctets = pnetGLOB_net_ooctets[i]; + idtsize = pnetGLOB_net_idtsize[i]; + ihdrovhd = pnetGLOB_net_ihdrovhd[i]; + odtsize = pnetGLOB_net_odtsize[i]; + ohdrovhd = pnetGLOB_net_ohdrovhd[i]; + ifspeed = pnetGLOB_save_nets[i].ifspeed; + iftype = pnetGLOB_save_nets[i].iftype; + if (ifspeed != 0) { + utilization = (((ioctets + ooctets) * 8) * 100.0) / ifspeed; + } else { + utilization = 0.0; + } + } +}; + +#endif _P_NETSTAT_CLASS_SE_ Added: trunk/orca/lib/SE/3.3.1/orca_p_netstat_class.se ============================================================================== --- (empty file) +++ trunk/orca/lib/SE/3.3.1/orca_p_netstat_class.se Tue Jun 1 13:11:29 2004 @@ -0,0 +1,247 @@ +// +// Copyright (c) 1993-2001 by Richard Pettit. All rights reserved. +// +// Some of this work was derived from include files containing the following +// copyrights. +// +// Copyright (c) 1986-1994 by Sun Microsystems, Inc. +// Copyright (c) 1983-1989 by AT&T +// Copyright (c) 1980-1993 by The Regents of the University of California. +// +// The work as a whole represents unique intellectual property and is +// copyright by Richard Pettit as shown on the first line. +// + +#ifndef _P_NETSTAT_CLASS_SE_ +#define _P_NETSTAT_CLASS_SE_ + +#include +#include +#include +#include +#include +#include + +#define NANODOUBLE 0.000000001 /* converts gethrtime to seconds */ + +/* robust difference generator for wrapping 32bit counters */ +/* unsigned to double difference */ + +#define UD_DIFF(now, then) (((double) now) >= ((double) then) ? \ + (now - then) : \ + ((double) now) + 4294967296.0 - ((double) then)) + +// All this crap must be global 'cause I can't fix the interpreter bug. + +double pnetGLOB_net_ipackets[]; /* these are rates */ +double pnetGLOB_net_idtsize[]; +double pnetGLOB_net_ihdrovhd[]; +double pnetGLOB_net_ierrors[]; +double pnetGLOB_net_opackets[]; +double pnetGLOB_net_odtsize[]; +double pnetGLOB_net_ohdrovhd[]; +double pnetGLOB_net_oerrors[]; +double pnetGLOB_net_collisions[]; +double pnetGLOB_net_defer[]; +double pnetGLOB_net_nocanput[]; +double pnetGLOB_net_ioctets[]; +double pnetGLOB_net_ooctets[]; +netif pnetGLOB_save_nets[]; /* these are absolute values */ +double pnetGLOB_save_et[]; + +int pnetGLOB_net_size = MAX_IF; + +pnetGLOB_realloc() +{ + pnetGLOB_net_ipackets = renew pnetGLOB_net_ipackets[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = renew pnetGLOB_net_idtsize[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = renew pnetGLOB_net_ihdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = renew pnetGLOB_net_ierrors[pnetGLOB_net_size]; + pnetGLOB_net_opackets = renew pnetGLOB_net_opackets[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = renew pnetGLOB_net_odtsize[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = renew pnetGLOB_net_ohdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = renew pnetGLOB_net_oerrors[pnetGLOB_net_size]; + pnetGLOB_net_collisions = renew pnetGLOB_net_collisions[pnetGLOB_net_size]; + pnetGLOB_net_defer = renew pnetGLOB_net_defer[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = renew pnetGLOB_net_nocanput[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = renew pnetGLOB_net_ioctets[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = renew pnetGLOB_net_ooctets[pnetGLOB_net_size]; + pnetGLOB_save_nets = renew pnetGLOB_save_nets[pnetGLOB_net_size]; + pnetGLOB_save_et = renew pnetGLOB_save_et[pnetGLOB_net_size]; +} + +class p_netstat { + + int number$; + char name$[12]; + + int net_count; + double ipackets; + double ierrors; + double idtsize; + double ihdrovhd; + double opackets; + double oerrors; + double odtsize; + double ohdrovhd; + double collisions; + double collpercent; + double nocanput; + double defer; + double ioctets; + double ooctets; + ulong_t ifspeed; + int iftype; + double utilization; + + p_netstat$() + { + int i; + int initialized = 0; + netif interface; + double et; + double now; + + /* do initialization code */ + if (initialized == 0) { + + pnetGLOB_net_ipackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_opackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_collisions = new double[pnetGLOB_net_size]; + pnetGLOB_net_defer = new double[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = new double[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = new double[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = new double[pnetGLOB_net_size]; + pnetGLOB_save_nets = new netif[pnetGLOB_net_size]; + pnetGLOB_save_et = new double[pnetGLOB_net_size]; + + /* grab initial info from netif class */ + for(refresh$(interface), i=0; i= net_count)) { + number$ = -1; + return; + } + + /* find out how many seconds have elapsed */ + now = gethrtime() * NANODOUBLE; + et = (now - pnetGLOB_save_et[i]); + + /* do computes if at least a second has gone by */ + if (et > 1.0) { + /* save the time */ + pnetGLOB_save_et[i] = now; + + /* grab the info for this net */ + interface.number$ = i; + refresh$(interface); + + /* compute new values */ + pnetGLOB_net_ipackets[i] = + UD_DIFF(interface.ipackets, pnetGLOB_save_nets[i].ipackets) / et; + pnetGLOB_net_ierrors[i] = + UD_DIFF(interface.ierrors, pnetGLOB_save_nets[i].ierrors) / et; + pnetGLOB_net_opackets[i] = + UD_DIFF(interface.opackets, pnetGLOB_save_nets[i].opackets) / et; + pnetGLOB_net_oerrors[i] = + UD_DIFF(interface.oerrors, pnetGLOB_save_nets[i].oerrors) / et; + pnetGLOB_net_collisions[i] = + UD_DIFF(interface.collisions, pnetGLOB_save_nets[i].collisions) / et; + pnetGLOB_net_nocanput[i] = + UD_DIFF(interface.nocanput, pnetGLOB_save_nets[i].nocanput) / et; + pnetGLOB_net_defer[i] = + UD_DIFF(interface.defer, pnetGLOB_save_nets[i].defer) / et; + pnetGLOB_net_ioctets[i] = + UD_DIFF(interface.ioctets, pnetGLOB_save_nets[i].ioctets) / et; + pnetGLOB_net_ooctets[i] = + UD_DIFF(interface.ooctets, pnetGLOB_save_nets[i].ooctets) / et; + if ( pnetGLOB_net_ipackets[i] == 0.0 ) { + pnetGLOB_net_idtsize[i] = 0.0; + pnetGLOB_net_ihdrovhd[i] = 0.0; + } else { + pnetGLOB_net_idtsize[i] = pnetGLOB_net_ioctets[i] / pnetGLOB_net_ipackets[i]; + pnetGLOB_net_ihdrovhd[i] = 100 * (40 * pnetGLOB_net_ipackets[i] / ( 40 * pnetGLOB_net_ipackets[i] + pnetGLOB_net_ioctets[i] )); + } + if ( pnetGLOB_net_opackets[i] == 0.0 ) { + pnetGLOB_net_odtsize[i] = 0.0; + pnetGLOB_net_ohdrovhd[i] = 0.0; + } else { + pnetGLOB_net_odtsize[i] = pnetGLOB_net_ooctets[i] / pnetGLOB_net_opackets[i]; + pnetGLOB_net_ohdrovhd[i] = 100 * (40 * pnetGLOB_net_opackets[i] / ( 40 * pnetGLOB_net_opackets[i] + pnetGLOB_net_ooctets[i] )); + } + /* save old */ + pnetGLOB_save_nets[i] = interface; + } + + /* update and return */ + strncpy(name$, pnetGLOB_save_nets[i].name$, 12); + ipackets = pnetGLOB_net_ipackets[i]; + ierrors = pnetGLOB_net_ierrors[i]; + opackets = pnetGLOB_net_opackets[i]; + oerrors = pnetGLOB_net_oerrors[i]; + collisions = pnetGLOB_net_collisions[i]; + if (opackets > 0.0) { + collpercent = collisions * 100.0 / opackets; + } else { + collpercent = 0.0; + } + nocanput = pnetGLOB_net_nocanput[i]; + defer = pnetGLOB_net_defer[i]; + ioctets = pnetGLOB_net_ioctets[i]; + ooctets = pnetGLOB_net_ooctets[i]; + idtsize = pnetGLOB_net_idtsize[i]; + ihdrovhd = pnetGLOB_net_ihdrovhd[i]; + odtsize = pnetGLOB_net_odtsize[i]; + ohdrovhd = pnetGLOB_net_ohdrovhd[i]; + ifspeed = pnetGLOB_save_nets[i].ifspeed; + iftype = pnetGLOB_save_nets[i].iftype; + if (ifspeed != 0) { + utilization = (((ioctets + ooctets) * 8) * 100.0) / ifspeed; + } else { + utilization = 0.0; + } + } +}; + +#endif _P_NETSTAT_CLASS_SE_ Added: trunk/orca/lib/SE/3.3/orca_p_netstat_class.se ============================================================================== --- (empty file) +++ trunk/orca/lib/SE/3.3/orca_p_netstat_class.se Tue Jun 1 13:11:29 2004 @@ -0,0 +1,247 @@ +// +// Copyright (c) 1993-2001 by Richard Pettit. All rights reserved. +// +// Some of this work was derived from include files containing the following +// copyrights. +// +// Copyright (c) 1986-1994 by Sun Microsystems, Inc. +// Copyright (c) 1983-1989 by AT&T +// Copyright (c) 1980-1993 by The Regents of the University of California. +// +// The work as a whole represents unique intellectual property and is +// copyright by Richard Pettit as shown on the first line. +// + +#ifndef _P_NETSTAT_CLASS_SE_ +#define _P_NETSTAT_CLASS_SE_ + +#include +#include +#include +#include +#include +#include + +#define NANODOUBLE 0.000000001 /* converts gethrtime to seconds */ + +/* robust difference generator for wrapping 32bit counters */ +/* unsigned to double difference */ + +#define UD_DIFF(now, then) (((double) now) >= ((double) then) ? \ + (now - then) : \ + ((double) now) + 4294967296.0 - ((double) then)) + +// All this crap must be global 'cause I can't fix the interpreter bug. + +double pnetGLOB_net_ipackets[]; /* these are rates */ +double pnetGLOB_net_idtsize[]; +double pnetGLOB_net_ihdrovhd[]; +double pnetGLOB_net_ierrors[]; +double pnetGLOB_net_opackets[]; +double pnetGLOB_net_odtsize[]; +double pnetGLOB_net_ohdrovhd[]; +double pnetGLOB_net_oerrors[]; +double pnetGLOB_net_collisions[]; +double pnetGLOB_net_defer[]; +double pnetGLOB_net_nocanput[]; +double pnetGLOB_net_ioctets[]; +double pnetGLOB_net_ooctets[]; +netif pnetGLOB_save_nets[]; /* these are absolute values */ +double pnetGLOB_save_et[]; + +int pnetGLOB_net_size = MAX_IF; + +pnetGLOB_realloc() +{ + pnetGLOB_net_ipackets = renew pnetGLOB_net_ipackets[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = renew pnetGLOB_net_idtsize[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = renew pnetGLOB_net_ihdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = renew pnetGLOB_net_ierrors[pnetGLOB_net_size]; + pnetGLOB_net_opackets = renew pnetGLOB_net_opackets[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = renew pnetGLOB_net_odtsize[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = renew pnetGLOB_net_ohdrovhd[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = renew pnetGLOB_net_oerrors[pnetGLOB_net_size]; + pnetGLOB_net_collisions = renew pnetGLOB_net_collisions[pnetGLOB_net_size]; + pnetGLOB_net_defer = renew pnetGLOB_net_defer[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = renew pnetGLOB_net_nocanput[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = renew pnetGLOB_net_ioctets[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = renew pnetGLOB_net_ooctets[pnetGLOB_net_size]; + pnetGLOB_save_nets = renew pnetGLOB_save_nets[pnetGLOB_net_size]; + pnetGLOB_save_et = renew pnetGLOB_save_et[pnetGLOB_net_size]; +} + +class p_netstat { + + int number$; + char name$[12]; + + int net_count; + double ipackets; + double ierrors; + double idtsize; + double ihdrovhd; + double opackets; + double oerrors; + double odtsize; + double ohdrovhd; + double collisions; + double collpercent; + double nocanput; + double defer; + double ioctets; + double ooctets; + ulong_t ifspeed; + int iftype; + double utilization; + + p_netstat$() + { + int i; + int initialized = 0; + netif interface; + double et; + double now; + + /* do initialization code */ + if (initialized == 0) { + + pnetGLOB_net_ipackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_idtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ihdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_ierrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_opackets = new double[pnetGLOB_net_size]; + pnetGLOB_net_odtsize = new double[pnetGLOB_net_size]; + pnetGLOB_net_ohdrovhd = new double[pnetGLOB_net_size]; + pnetGLOB_net_oerrors = new double[pnetGLOB_net_size]; + pnetGLOB_net_collisions = new double[pnetGLOB_net_size]; + pnetGLOB_net_defer = new double[pnetGLOB_net_size]; + pnetGLOB_net_nocanput = new double[pnetGLOB_net_size]; + pnetGLOB_net_ioctets = new double[pnetGLOB_net_size]; + pnetGLOB_net_ooctets = new double[pnetGLOB_net_size]; + pnetGLOB_save_nets = new netif[pnetGLOB_net_size]; + pnetGLOB_save_et = new double[pnetGLOB_net_size]; + + /* grab initial info from netif class */ + for(refresh$(interface), i=0; i= net_count)) { + number$ = -1; + return; + } + + /* find out how many seconds have elapsed */ + now = gethrtime() * NANODOUBLE; + et = (now - pnetGLOB_save_et[i]); + + /* do computes if at least a second has gone by */ + if (et > 1.0) { + /* save the time */ + pnetGLOB_save_et[i] = now; + + /* grab the info for this net */ + interface.number$ = i; + refresh$(interface); + + /* compute new values */ + pnetGLOB_net_ipackets[i] = + UD_DIFF(interface.ipackets, pnetGLOB_save_nets[i].ipackets) / et; + pnetGLOB_net_ierrors[i] = + UD_DIFF(interface.ierrors, pnetGLOB_save_nets[i].ierrors) / et; + pnetGLOB_net_opackets[i] = + UD_DIFF(interface.opackets, pnetGLOB_save_nets[i].opackets) / et; + pnetGLOB_net_oerrors[i] = + UD_DIFF(interface.oerrors, pnetGLOB_save_nets[i].oerrors) / et; + pnetGLOB_net_collisions[i] = + UD_DIFF(interface.collisions, pnetGLOB_save_nets[i].collisions) / et; + pnetGLOB_net_nocanput[i] = + UD_DIFF(interface.nocanput, pnetGLOB_save_nets[i].nocanput) / et; + pnetGLOB_net_defer[i] = + UD_DIFF(interface.defer, pnetGLOB_save_nets[i].defer) / et; + pnetGLOB_net_ioctets[i] = + UD_DIFF(interface.ioctets, pnetGLOB_save_nets[i].ioctets) / et; + pnetGLOB_net_ooctets[i] = + UD_DIFF(interface.ooctets, pnetGLOB_save_nets[i].ooctets) / et; + if ( pnetGLOB_net_ipackets[i] == 0.0 ) { + pnetGLOB_net_idtsize[i] = 0.0; + pnetGLOB_net_ihdrovhd[i] = 0.0; + } else { + pnetGLOB_net_idtsize[i] = pnetGLOB_net_ioctets[i] / pnetGLOB_net_ipackets[i]; + pnetGLOB_net_ihdrovhd[i] = 100 * (40 * pnetGLOB_net_ipackets[i] / ( 40 * pnetGLOB_net_ipackets[i] + pnetGLOB_net_ioctets[i] )); + } + if ( pnetGLOB_net_opackets[i] == 0.0 ) { + pnetGLOB_net_odtsize[i] = 0.0; + pnetGLOB_net_ohdrovhd[i] = 0.0; + } else { + pnetGLOB_net_odtsize[i] = pnetGLOB_net_ooctets[i] / pnetGLOB_net_opackets[i]; + pnetGLOB_net_ohdrovhd[i] = 100 * (40 * pnetGLOB_net_opackets[i] / ( 40 * pnetGLOB_net_opackets[i] + pnetGLOB_net_ooctets[i] )); + } + /* save old */ + pnetGLOB_save_nets[i] = interface; + } + + /* update and return */ + strncpy(name$, pnetGLOB_save_nets[i].name$, 12); + ipackets = pnetGLOB_net_ipackets[i]; + ierrors = pnetGLOB_net_ierrors[i]; + opackets = pnetGLOB_net_opackets[i]; + oerrors = pnetGLOB_net_oerrors[i]; + collisions = pnetGLOB_net_collisions[i]; + if (opackets > 0.0) { + collpercent = collisions * 100.0 / opackets; + } else { + collpercent = 0.0; + } + nocanput = pnetGLOB_net_nocanput[i]; + defer = pnetGLOB_net_defer[i]; + ioctets = pnetGLOB_net_ioctets[i]; + ooctets = pnetGLOB_net_ooctets[i]; + idtsize = pnetGLOB_net_idtsize[i]; + ihdrovhd = pnetGLOB_net_ihdrovhd[i]; + odtsize = pnetGLOB_net_odtsize[i]; + ohdrovhd = pnetGLOB_net_ohdrovhd[i]; + ifspeed = pnetGLOB_save_nets[i].ifspeed; + iftype = pnetGLOB_save_nets[i].iftype; + if (ifspeed != 0) { + utilization = (((ioctets + ooctets) * 8) * 100.0) / ifspeed; + } else { + utilization = 0.0; + } + } +}; + +#endif _P_NETSTAT_CLASS_SE_ From sean at seanoneill.info Wed Jun 2 09:03:47 2004 From: sean at seanoneill.info (sean at seanoneill.info) Date: Wed, 2 Jun 2004 09:03:47 -0700 Subject: [Orca-checkins] propchange - r332 svn:log Message-ID: <200406021603.i52G3lYn007763@orcaware.com> Author: sean at seanoneill.info Revision: 332 Property Name: svn:log New Property Value: * ADDED the following files: lib/SE/3.2.1/orca_p_netstat_class.se lib/SE/3.3.1/orca_p_netstat_class.se lib/SE/3.3/orca_p_netstat_class.se The RICHPse package file p_netstat_class.se file was modified to compute the TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead. The modified file was copied into the lib/SE/ specific directories for orcallator.se to include at runtime. Name changed to orca_p_netstat_class.se to match currert naming convention. * data_gatherers/orcallator/orcallator.cfg.in Modified to create the graphs for TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead. * data_gatherers/orcallator/orcallator.se Modified to import new orca_p_netstat_class.se include file. Also added code to collect TCP (system wide) and individual interface metrics for In/Out Packet Data Payload Size and In/Out Packet Header Overhead data. From blair at orcaware.com Sat Jun 5 22:39:38 2004 From: blair at orcaware.com (Blair Zajac) Date: Sat, 5 Jun 2004 22:39:38 -0700 Subject: [Orca-checkins] r333 - trunk/orca Message-ID: <200406060539.i565dcAr012758@orcaware.com> Author: blair Date: Sat Jun 5 22:37:49 2004 New Revision: 333 Modified: trunk/orca/configure.in Log: Prepare Orca to have a local copy of the version Perl module. To avoid confusion with a variable named 'orca_cv_perl_version', put the word module in the variable names. * configure.in: s/orca_cv_perl/orca_cv_perl_module/. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in Sat Jun 5 22:37:49 2004 @@ -348,9 +348,12 @@ # options for RRDtool if it is not already declared. # expr "$ORCA_CONFIGURE_COMMAND_LINE" : "--enable-shared" >/dev/null 2>&1 || ORCA_CONFIGURE_COMMAND_LINE="$ORCA_CONFIGURE_COMMAND_LINE --enable-shared" -dnl BORP_PERL_MODULE(orca_cv_perl_compress_zlib, $PERL, Compress::Zlib, $COMPRESS_ZLIB_VER) -dnl test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_compress_zlib=no -dnl if test "$orca_cv_perl_compress_zlib" = no; then +dnl BORP_PERL_MODULE(orca_cv_perl_module_compress_zlib, +dnl $PERL, +dnl Compress::Zlib, +dnl $COMPRESS_ZLIB_VER) +dnl test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_compress_zlib=no +dnl if test "$orca_cv_perl_module_compress_zlib" = no; then dnl MAKE_COMPRESS_ZLIB=make_compress_zlib dnl TEST_COMPRESS_ZLIB=test_compress_zlib dnl INSTALL_PERL_COMPRESS_ZLIB=install_perl_compress_zlib @@ -363,9 +366,12 @@ AC_SUBST(CLEAN_COMPRESS_ZLIB) AC_SUBST(DISTCLEAN_COMPRESS_ZLIB) -BORP_PERL_MODULE(orca_cv_perl_data_dumper, $PERL, Data::Dumper, $DATA_DUMPER_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_data_dumper=no -if test "$orca_cv_perl_data_dumper" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_data_dumper, + $PERL, + Data::Dumper, + $DATA_DUMPER_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_data_dumper=no +if test "$orca_cv_perl_module_data_dumper" = no; then MAKE_DATA_DUMPER=make_data_dumper TEST_DATA_DUMPER=test_data_dumper INSTALL_PERL_DATA_DUMPER=install_perl_data_dumper @@ -378,9 +384,12 @@ AC_SUBST(CLEAN_DATA_DUMPER) AC_SUBST(DISTCLEAN_DATA_DUMPER) -BORP_PERL_MODULE(orca_cv_perl_date_parse, $PERL, Date::Parse, $DATE_PARSE_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_date_parse=no -if test "$orca_cv_perl_date_parse" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_date_parse, + $PERL, + Date::Parse, + $DATE_PARSE_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_date_parse=no +if test "$orca_cv_perl_module_date_parse" = no; then MAKE_DATE_PARSE=make_date_parse TEST_DATE_PARSE=test_date_parse INSTALL_PERL_DATE_PARSE=install_perl_date_parse @@ -393,9 +402,12 @@ AC_SUBST(CLEAN_DATE_PARSE) AC_SUBST(DISTCLEAN_DATE_PARSE) -BORP_PERL_MODULE(orca_cv_perl_devel_dprof, $PERL, Devel::DProf, $DEVEL_DPROF_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_devel_dprof=no -if test "$orca_cv_perl_devel_dprof" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_devel_dprof, + $PERL, + Devel::DProf, + $DEVEL_DPROF_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_devel_dprof=no +if test "$orca_cv_perl_module_devel_dprof" = no; then MAKE_DEVEL_DPROF=make_devel_dprof TEST_DEVEL_DPROF=test_devel_dprof INSTALL_PERL_DEVEL_DPROF=install_perl_devel_dprof @@ -408,9 +420,12 @@ AC_SUBST(CLEAN_DEVEL_DPROF) AC_SUBST(DISTCLEAN_DEVEL_DPROF) -BORP_PERL_MODULE(orca_cv_perl_digest_md5, $PERL, Digest::MD5, $DIGEST_MD5_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_digest_md5=no -if test "$orca_cv_perl_digest_md5" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_digest_md5, + $PERL, + Digest::MD5, + $DIGEST_MD5_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_digest_md5=no +if test "$orca_cv_perl_module_digest_md5" = no; then MAKE_DIGEST_MD5=make_digest_md5 TEST_DIGEST_MD5=test_digest_md5 INSTALL_PERL_DIGEST_MD5=install_perl_digest_md5 @@ -423,9 +438,12 @@ AC_SUBST(CLEAN_DIGEST_MD5) AC_SUBST(DISTCLEAN_DIGEST_MD5) -BORP_PERL_MODULE(orca_cv_perl_math_intervalsearch, $PERL, Math::IntervalSearch, $MATH_INTERVALSEARCH_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_math_intervalsearch=no -if test "$orca_cv_perl_math_intervalsearch" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_math_intervalsearch, + $PERL, + Math::IntervalSearch, + $MATH_INTERVALSEARCH_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_math_intervalsearch=no +if test "$orca_cv_perl_module_math_intervalsearch" = no; then MAKE_MATH_INTERVALSEARCH=make_math_intervalsearch TEST_MATH_INTERVALSEARCH=test_math_intervalsearch INSTALL_PERL_MATH_INTERVALSEARCH=install_perl_math_intervalsearch @@ -438,9 +456,12 @@ AC_SUBST(CLEAN_MATH_INTERVALSEARCH) AC_SUBST(DISTCLEAN_MATH_INTERVALSEARCH) -BORP_PERL_MODULE(orca_cv_perl_rrds, $PERL, RRDs, $RRDTOOL_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_rrds=no -if test "$orca_cv_perl_rrds" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_rrds, + $PERL, + RRDs, + $RRDTOOL_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_rrds=no +if test "$orca_cv_perl_module_rrds" = no; then BUILD_RRD=yes fi if test "$BUILD_RRD" = yes; then @@ -456,9 +477,12 @@ AC_SUBST(CLEAN_RRDTOOL) AC_SUBST(DISTCLEAN_RRDTOOL) -BORP_PERL_MODULE(orca_cv_perl_storable, $PERL, Storable, $STORABLE_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_storable=no -if test "$orca_cv_perl_storable" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_storable, + $PERL, + Storable, + $STORABLE_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_storable=no +if test "$orca_cv_perl_module_storable" = no; then MAKE_STORABLE=make_storable TEST_STORABLE=test_storable INSTALL_PERL_STORABLE=install_perl_storable @@ -471,9 +495,12 @@ AC_SUBST(CLEAN_STORABLE) AC_SUBST(DISTCLEAN_STORABLE) -BORP_PERL_MODULE(orca_cv_perl_time_hires, $PERL, Time::HiRes, $TIME_HIRES_VER) -test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_time_hires=no -if test "$orca_cv_perl_time_hires" = no; then +BORP_PERL_MODULE(orca_cv_perl_module_time_hires, + $PERL, + Time::HiRes, + $TIME_HIRES_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_time_hires=no +if test "$orca_cv_perl_module_time_hires" = no; then MAKE_TIME_HIRES=make_time_hires TEST_TIME_HIRES=test_time_hires INSTALL_PERL_TIME_HIRES=install_perl_time_hires From blair at orcaware.com Sat Jun 5 23:04:23 2004 From: blair at orcaware.com (Blair Zajac) Date: Sat, 5 Jun 2004 23:04:23 -0700 Subject: [Orca-checkins] r334 - in trunk/orca: . config packages packages/version-0.39 packages/version-0.39/lib packages/version-0.39/t Message-ID: <200406060604.i5664NkQ013487@orcaware.com> Author: blair Date: Sat Jun 5 23:02:34 2004 New Revision: 334 Added: trunk/orca/packages/version-0.39/ trunk/orca/packages/version-0.39/Changes trunk/orca/packages/version-0.39/MANIFEST trunk/orca/packages/version-0.39/META.yml trunk/orca/packages/version-0.39/Makefile.PL trunk/orca/packages/version-0.39/README trunk/orca/packages/version-0.39/lib/ trunk/orca/packages/version-0.39/lib/version.pm trunk/orca/packages/version-0.39/ppport.h trunk/orca/packages/version-0.39/t/ trunk/orca/packages/version-0.39/t/01base.t (contents, props changed) trunk/orca/packages/version-0.39/typemap (contents, props changed) trunk/orca/packages/version-0.39/util.c trunk/orca/packages/version-0.39/util.h trunk/orca/packages/version-0.39/version.xs Modified: trunk/orca/INSTALL trunk/orca/config/acinclude.m4 trunk/orca/configure.in trunk/orca/packages/Makefile.in Log: Add the Perl module version 0.39 to the distribution. It will be used to let the user require specific versions of Orca. * configure.in (VERSION_DIR): New variable pointing to the version directory. (VERSION_VER): New variable holding the required version of the version module. Check for the required version of the Perl version module. * config/acinclude.m4 (BORP_PERL_MODULE): Remove the word 'version' from the checking message. * INSTALL (Determine which Perl modules need compiling and installing): Add version 0.39 to the list of Perl modules. Add instructions on how to download and install the version module. * packages/Makefile.in: Add rules to build the Perl version module. * packages/version-0.39: Directory contents copied from version-0.39.tar.gz. Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL Sat Jun 5 23:02:34 2004 @@ -178,6 +178,7 @@ RRDs >= 1.000461 >= 1.0.46 1.0.46 Storable >= 2.12 >= 2.12 2.12 Time::HiRes Not required by Orca 1.59 + version >= 0.39 >= 0.39 0.39 All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), @@ -287,6 +288,17 @@ % make test % make install + version + + http://www.perl.com/CPAN/authors/id/J/JP/JPEACOCK/version-0.39.tar.gz + + % gunzip -c version-0.39.tar.gz | tar xvf - + % cd version-0.39 + % perl Makefile.PL + % make + % make test + % make install + 5) Make Orca and any necessary Perl modules. To make Orca and these Perl modules run the following command: Modified: trunk/orca/config/acinclude.m4 ============================================================================== --- trunk/orca/config/acinclude.m4 (original) +++ trunk/orca/config/acinclude.m4 Sat Jun 5 23:02:34 2004 @@ -5,7 +5,7 @@ dnl BORP_PERL_MODULE(DEFINE, PATH_TO_PERL, MODULE_NAME, MODULE_VERSION, dnl [ACTION_IF_FOUND, [ACTION_IF_NOT_FOUND]] AC_DEFUN([BORP_PERL_MODULE], [ - AC_MSG_CHECKING([if Perl module $3 version $4 is installed]) + AC_MSG_CHECKING([if Perl module $3 $4 is installed]) if $2 ./config/check_for_perl_mod $3 $4; then $1=yes ifelse([$5], , , [$5]) Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in Sat Jun 5 23:02:34 2004 @@ -43,6 +43,8 @@ STORABLE_VER=2.12 TIME_HIRES_DIR=Time-HiRes-1.59 TIME_HIRES_VER=1.59 +VERSION_DIR=version-0.39 +VERSION_VER=0.39 AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) @@ -53,6 +55,8 @@ AC_SUBST(RRDTOOL_DIR) AC_SUBST(STORABLE_DIR) AC_SUBST(TIME_HIRES_DIR) +AC_SUBST(VERSION_DIR) + AC_SUBST(COMPRESS_ZLIB_VER) AC_SUBST(DATA_DUMPER_VER) AC_SUBST(DATE_PARSE_VER) @@ -62,6 +66,7 @@ AC_SUBST(RRDTOOL_VER) AC_SUBST(STORABLE_VER) AC_SUBST(TIME_HIRES_VER) +AC_SUBST(VERSION_VER) # Get the current working directory and the config directory. cwd=`pwd` @@ -517,6 +522,24 @@ AC_SUBST(DISTCLEAN_TIME_HIRES) AC_SUBST(PERL_USE_TIME_HIRES) +BORP_PERL_MODULE(orca_cv_perl_module_version, + $PERL, + version, + $VERSION_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_module_version=no +if test "$orca_cv_perl_module_version" = no; then + MAKE_VERSION=make_version + TEST_VERSION=test_version + INSTALL_PERL_VERSION=install_perl_version + CLEAN_VERSION=clean_version + DISTCLEAN_VERSION=distclean_version +fi +AC_SUBST(MAKE_VERSION) +AC_SUBST(TEST_VERSION) +AC_SUBST(INSTALL_PERL_VERSION) +AC_SUBST(CLEAN_VERSION) +AC_SUBST(DISTCLEAN_VERSION) + # Define the INSTALL and MKDIR variables to point to the scripts in # the config directory. INSTALL="$config_dir/install-sh -c" Modified: trunk/orca/packages/Makefile.in ============================================================================== --- trunk/orca/packages/Makefile.in (original) +++ trunk/orca/packages/Makefile.in Sat Jun 5 23:02:34 2004 @@ -18,6 +18,7 @@ math_intervalsearch_dir = @MATH_INTERVALSEARCH_DIR@ rrdtool_dir = @RRDTOOL_DIR@ storable_dir = @STORABLE_DIR@ +version_dir = @VERSION_DIR@ MAKE_COMPRESS_ZLIB = @MAKE_COMPRESS_ZLIB@ MAKE_DATA_DUMPER = @MAKE_DATA_DUMPER@ @@ -27,6 +28,7 @@ MAKE_MATH_INTERVALSEARCH = @MAKE_MATH_INTERVALSEARCH@ MAKE_RRDTOOL = @MAKE_RRDTOOL@ MAKE_STORABLE = @MAKE_STORABLE@ +MAKE_VERSION = @MAKE_VERSION@ MAKE_TARGETS = $(MAKE_COMPRESS_ZLIB) \ $(MAKE_DATA_DUMPER) \ $(MAKE_DATE_PARSE) \ @@ -34,7 +36,8 @@ $(MAKE_DIGEST_MD5) \ $(MAKE_MATH_INTERVALSEARCH) \ $(MAKE_RRDTOOL) \ - $(MAKE_STORABLE) + $(MAKE_STORABLE) \ + $(MAKE_VERSION) TEST_COMPRESS_ZLIB = @TEST_COMPRESS_ZLIB@ TEST_DATA_DUMPER = @TEST_DATA_DUMPER@ @@ -44,6 +47,7 @@ TEST_MATH_INTERVALSEARCH = @TEST_MATH_INTERVALSEARCH@ TEST_RRDTOOL = @TEST_RRDTOOL@ TEST_STORABLE = @TEST_STORABLE@ +TEST_VERSION = @TEST_VERSION@ TEST_TARGETS = $(TEST_COMPRESS_ZLIB) \ $(TEST_DATA_DUMPER) \ $(TEST_DATE_PARSE) \ @@ -51,7 +55,8 @@ $(TEST_DIGEST_MD5) \ $(TEST_MATH_INTERVALSEARCH) \ $(TEST_RRDTOOL) \ - $(TEST_STORABLE) + $(TEST_STORABLE) \ + $(TEST_VERSION) INSTALL_PERL_COMPRESS_ZLIB = @INSTALL_PERL_COMPRESS_ZLIB@ INSTALL_PERL_DATA_DUMPER = @INSTALL_PERL_DATA_DUMPER@ @@ -61,6 +66,7 @@ INSTALL_PERL_MATH_INTERVALSEARCH = @INSTALL_PERL_MATH_INTERVALSEARCH@ INSTALL_PERL_RRDTOOL = @INSTALL_PERL_RRDTOOL@ INSTALL_PERL_STORABLE = @INSTALL_PERL_STORABLE@ +INSTALL_PERL_VERSION = @INSTALL_PERL_VERSION@ INSTALL_PERL_TARGETS = $(INSTALL_PERL_COMPRESS_ZLIB) \ $(INSTALL_PERL_DATA_DUMPER) \ $(INSTALL_PERL_DATE_PARSE) \ @@ -68,7 +74,8 @@ $(INSTALL_PERL_DIGEST_MD5) \ $(INSTALL_PERL_MATH_INTERVALSEARCH) \ $(INSTALL_PERL_RRDTOOL) \ - $(INSTALL_PERL_STORABLE) + $(INSTALL_PERL_STORABLE) \ + $(INSTALL_PERL_VERSION) INSTALL_LIB_RRDTOOL = @INSTALL_LIB_RRDTOOL@ INSTALL_LIB_TARGETS = $(INSTALL_LIB_RRDTOOL) @@ -81,6 +88,7 @@ CLEAN_MATH_INTERVALSEARCH = @CLEAN_MATH_INTERVALSEARCH@ CLEAN_RRDTOOL = @CLEAN_RRDTOOL@ CLEAN_STORABLE = @CLEAN_STORABLE@ +CLEAN_VERSION = @CLEAN_VERSION@ CLEAN_TARGETS = $(CLEAN_COMPRESS_ZLIB) \ $(CLEAN_DATA_DUMPER) \ $(CLEAN_DATE_PARSE) \ @@ -88,7 +96,8 @@ $(CLEAN_DIGEST_MD5) \ $(CLEAN_MATH_INTERVALSEARCH) \ $(CLEAN_RRDTOOL) \ - $(CLEAN_STORABLE) + $(CLEAN_STORABLE) \ + $(CLEAN_VERSION) DISTCLEAN_COMPRESS_ZLIB = @DISTCLEAN_COMPRESS_ZLIB@ DISTCLEAN_DATA_DUMPER = @DISTCLEAN_DATA_DUMPER@ @@ -98,14 +107,16 @@ DISTCLEAN_MATH_INTERVALSEARCH = @DISTCLEAN_MATH_INTERVALSEARCH@ DISTCLEAN_RRDTOOL = @DISTCLEAN_RRDTOOL@ DISTCLEAN_STORABLE = @DISTCLEAN_STORABLE@ -DISTCLEAN_TARGETS = $(DISTCLEAN_COMPRESS_ZLIB) \ +DISTCLEAN_VERSION = @DISTCLEAN_VERSION@ +DISTCLEAN_TARGETS = $(DISTCLEAN_COMPRESS_ZLIB) \ $(DISTCLEAN_DATA_DUMPER) \ $(DISTCLEAN_DATE_PARSE) \ $(DISTCLEAN_DEVEL_DPROF) \ $(DISTCLEAN_DIGEST_MD5) \ $(DISTCLEAN_MATH_INTERVALSEARCH) \ $(DISTCLEAN_RRDTOOL) \ - $(DISTCLEAN_STORABLE) + $(DISTCLEAN_STORABLE) \ + $(DISTCLEAN_VERSION) all: Makefile $(MAKE_TARGETS) @@ -163,6 +174,12 @@ $(storable_dir)/Makefile: $(storable_dir)/Makefile.PL $(PERL) cd $(storable_dir) && $(PERL) Makefile.PL +make_version: $(version_dir)/Makefile + cd $(version_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" + +$(version_dir)/Makefile: $(version_dir)/Makefile.PL $(PERL) + cd $(version_dir) && $(PERL) Makefile.PL + test: test_modules: $(TEST_TARGETS) @@ -191,6 +208,9 @@ test_storable: $(storable_dir)/Makefile cd $(storable_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" test +test_version: $(version_dir)/Makefile + cd $(version_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" test + install: $(INSTALL_LIB_TARGETS) install_lib_rrdtool: make_rrdtool @@ -222,6 +242,9 @@ install_perl_storable: $(storable_dir)/Makefile cd $(storable_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install +install_perl_version: $(version_dir)/Makefile + cd $(version_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install + clean: $(CLEAN_TARGETS) clean_compress_zlib: clean_rrdtool @@ -269,6 +292,12 @@ (cd $(storable_dir) && $(MAKE) clean); \ fi +clean_version: + @if test -r $(version_dir)/Makefile; then \ + echo 'cd $(version_dir) && $(MAKE) clean'; \ + (cd $(version_dir) && $(MAKE) clean); \ + fi + distclean: $(DISTCLEAN_TARGETS) $(RM) Makefile @@ -289,5 +318,7 @@ distclean_storable: clean_storable +distclean_version: clean_version + Makefile: Makefile.in cd .. && CONFIG_FILES=packages/Makefile ./config.status Added: trunk/orca/packages/version-0.39/Changes ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/Changes Sat Jun 5 23:02:34 2004 @@ -0,0 +1,439 @@ +2004-04-13 21:15:32 John Peacock + + M util.c + Change scan_vstring to treat alpha versions like numeric if + appropriate (only one decimal) + + M t/01base.t + Alter testing and add new tests for alpha version code + + M lib/version.pm + Continue to improve (hopefully) POD including new alpha version + behavior + + M README + Big red warnings about changing behavior + +2004-04-12 20:53:52 John Peacock + + New branch to fix alpha versions + +2004-04-11 10:44:55 John Peacock + + M MANIFEST + Forgot to delete the version::AlphaBeta files from packing list + +2004-04-11 10:43:34 John Peacock + + D lib/version + D t/02AlphaBeta.t + Delete these files and release independently on CPAN + + M util.c + new() of version object makes copy + + M t/01base.t + test new() on existing version object + + M lib/version.pm + M README + Document new() and elimination of version::AlphaBeta from this distro + + M version.xs + Only call vnumify() if a version object in UNIVERSAL::VERSION + +2004-04-09 23:58:31 John Peacock + + Brnach for new version + +2004-04-03 14:30:01 John Peacock + + * lib/version.pm + Change all uses of "new version" to "version->new()" + Check all examples against current code/behavior + Add doc warnings for edge cases + +2004-03-27 22:45:18 John Peacock + + * util.c + quoted versions, e.g qv() and v-string, always get at least 3 terms + change vstringify() to vnormal() + new vstringify() to display either vnumify() or vnormal() form + + * util.h + Add #define for SVf (SV format) only needed for Perl 5.005_03 + + * version.xs + new XS class function normal() + UNIVERSAL::VERSION warning displays both numify() and normal() forms, + also returns exclusively numify() form + + * lib/version.pm + Extensive POD rewrite to explain normal form and how stringify works + + * t/01base.t + Altered tests to correspond to new stringify behavior + + * README + Add warning about new stringify behavior + + * ppport.h + Copied from recent bleadperl build + +2004-03-23 21:07:08 John Peacock + + Create a new tag before changing anything + +2004-02-01 20:30:01 John Peacock + + * README + Include a short blurb on the qv() operator + + * lib/version.pm + Reformat the description of the qv() operator + Change the $VERSION for a release + + * version.xs + Support using qv() with v-strings in Perl 5.8.1+ + + * t/01base.t + Tests for qv() and v-strings + +2004-02-01 20:29:11 John Peacock + + Copy the files prior to updating to new version + +2004-01-29 22:35:40 John Peacock + + Tag for 0.35.0 release + +2004-01-29 21:46:15 John Peacock + + * lib/version.pm + Update the $VERSION prior to release + + * MANIFEST + Remove Changes as it is now autocreated + + * Makefile.PL + Autocreate Changes as part of 'dist' target + + * util.c + Correct handling of v-strings in new_version() + + * version.xs, util.c + Change use of SvPV_nolen() with SvPV() so that 5.005_03 works again + + * t/01base.t + Add tests for v-string creation (skipped on Perl < 5.8.0) + +2004-01-29 20:35:12 John Peacock + + * Create a branch from which to eventually release 0.35 + +2004-01-29 20:31:22 John Peacock + + * Belately create tag for version 0.34 + +2003-12-29 10:35:34 John Peacock + + * typemap + Stop automatically dereferencing input variable + * lib/version.pm + Update $VERSION for a change + * README + Include warning on memory leaks + * util.c + (new_version): use upg_version exclusively + (upg_version): move code from new_version here + * version.xs + Stop dereferencing input variables + Stop assuming that the PV has a value + +2003-12-28 23:39:08 John Peacock + + * t/01base.t + Replace postfix increment with prefix increment to prevent erroneous + "Attempt to free..." errors + Add test of CVS $Revision: $ style versions + + * util.c + Rewrite new_version to free temporary string variable + + * version.xs + Rewrite version->new() to eliminate temp string for CVS $Revision: $ + Rewrite version->qv() to use scan_version instead of new_version + +2003-12-21 13:00:05 John Peacock + + M version.xs + Go through code to ensure that there are no leaking scalars + Sadly, there are still leaks from version::VERSION of unknown origins + +2003-12-20 19:27:00 John Peacock + + M t/02AlphaBeta.t + M lib/version/AlphaBeta.pm + Implement an alternate object representation + Overload stringify() with custom function + +2003-10-25 21:17:52 John Peacock + + M t/02AlphaBeta.t + Add empty derived class and modify tests to run + M t/01base.t + Work around bug with postfix increment under all Perl < bleadperl + +2003-09-10 15:05:07 John Peacock + + Fix for Ticket #3764 - need to strip final term before chop() + Implement qv() function and document/test + + +2003-09-10 06:40:15 John Peacock + + Remove the changes file from the repository. + Generate it before release: + + svn log file:///var/svn/modules/version/trunk + + and eventually by 'release.pl --changes' + + +2003-09-10 06:36:49 John Peacock + + Finish backporting bleadperl changes + Special case test for 5.005_03 + Patch ppport.h to support IVSIZE for 5.005_03 + + +2003-09-10 05:13:09 John Peacock + + No, really delete the lines from MANIFEST + Last bit of clean up in the POD + +2003-09-10 04:59:31 John Peacock + + Delete version::Empty module and include in t/01base.t instead + Correct MANIFEST (delete missing files and add ppport.h) + Make version::stringify() return at least three subversions + +2003-09-09 15:20:40 John Peacock + + Integrate changes from bleadperl + Combine emptyclass.t test into 01base.t + Use ppport.h instead of homebrewed #define's + + +2003-09-07 09:13:53 John Peacock + + Extend version::new() to handle derived classes + Abstract t/01base.t into external file + Create and test empty derived class + + FIX: "attempt to free unreferenced scalar" during testing + +2003-07-09 10:11:57 John Peacock + + Merge changes made accidently on branch back to head + +2003-06-13 21:34:50 John Peacock + + Forgot to commit this before releasing. + +2003-06-13 15:02:11 John Peacock + + Correct the example code (again) to correct for CVS update problems + +2003-06-13 14:56:27 John Peacock + + Reformatted POD's from + +2003-06-13 12:51:14 John Peacock + + Change reference from "beta" to "alpha" to follow PAUSE convention + Add new function ->is_alpha() to test for alpha versions + Add docs for all logical operations on version objects + Fix example to have matching versions (old CVS issue) + +2003-06-13 12:48:05 John Peacock + + Implement version::AlphaBeta module + Copy repository history from CVS into subversion + +2003-06-13 12:48:02 John Peacock + + To prepare to load /home/jpeacock/tmp/version-0.28 into version/trunk, + perform 2 renames. + + * version/trunk/t/1.t: Renamed from version/trunk/t/version.t. + * version/trunk/lib/version.pm: Renamed from version/trunk/version.pm. + +2003-01-05 17:45:41 John Peacock + + Extract most recent log messages for main file + +2003-01-05 17:43:51 John Peacock + + Rewrite POD to call a v-string a v-string + Reformat POD to look nicer + +2003-01-05 17:42:16 John Peacock + + Make vnumify return an actual NV (instead of an SV which looks like one) + +2003-01-05 17:40:50 John Peacock + + Make warnings even more dire + +2003-01-05 17:37:32 John Peacock + + change comment message to more accurately reflect the test + +2002-12-27 10:15:29 John Peacock + + Rewrite to support new model of "Numeric Versions" and "String Versions" + +2002-12-17 21:28:48 John Peacock + + New version to cope with GSAR's vision of bare number versions + +2002-12-05 06:51:34 John Peacock + + Make -w clean tests + +2002-12-05 05:41:24 John Peacock + + Bring into sync with perl-current + +2002-11-18 05:35:54 John Peacock + + Bring current with repository version + +2002-11-18 05:33:23 John Peacock + + Fix compile errors under threaded Perl's + Supress {Unquoted string version} warnings + +2002-11-18 05:33:23 John Peacock + + + Fix compile errors under threaded Perls + +2002-11-18 05:24:17 John Peacock + + Fix compile errors under threaded Perl's + Supress {Unquoted string "version"} warnings + +2002-10-14 21:27:00 John Peacock + + Fix typos + Fix handling of null versions + +2002-10-10 20:41:54 John Peacock + + use Perl_croak from C code + +2002-10-08 20:51:20 John Peacock + + Recover gracefully to null versions (rather than core) + +2002-10-08 20:44:24 John Peacock + + Recover gracefully to null versions (rather than core) + +2002-10-04 22:57:00 John Peacock + + Document extended decimal version parsing + +2002-10-04 21:01:45 John Peacock + + Force all files to next major revision (so the version works) + +2002-10-04 20:53:33 John Peacock + + Add tests for 1.002003 => 1.2.3 + +2002-10-04 20:53:10 John Peacock + + Add support for 1.002003 => 1.2.3 + +2002-10-04 20:31:01 John Peacock + + Remove dependency on Exporter.pm + +2002-09-29 19:46:23 John Peacock + + Update with version from perl-current + +2002-09-29 19:44:47 John Peacock + + Change vstringify and vnumify + Reword main POD slightly + +2002-09-28 14:38:15 John Peacock + + Final changes to release to CPAN + Merged code into perl-current + +2002-09-28 06:21:16 John Peacock + + Ready to release to CPAN + +2002-09-28 06:15:34 John Peacock + + POD changes + +2002-09-28 06:15:16 John Peacock + + Cannot use SvPV_nolen in 5.005_03 + +2002-09-22 21:40:02 John Peacock + + Document the UNIVERSAL::VERSION replacement + +2002-09-22 21:23:01 John Peacock + + Successfully create and test my own UNIVERSAL::VERSION replacement + +2002-09-16 15:35:58 John Peacock + + Improve the testing of beta versions + +2002-09-16 08:12:49 John Peacock + + More POD changes + +2002-09-16 07:52:08 John Peacock + + Add additional testing + Add POD + +2002-09-16 06:17:41 John Peacock + + Finally works in 5.005_03, 5.6.1, and 5.8.0 + +2002-09-15 06:13:51 John Peacock + + Doesn't work any more? + +2002-09-14 16:08:23 John Peacock + + working AV objects in 5.6.x only + +2002-09-14 16:08:23 John Peacock + + *** empty log message *** + +2002-09-13 23:12:25 John Peacock + + Finished for the night + +2002-09-13 22:28:39 John Peacock + + almost working AV style version objects + +2002-09-13 21:59:09 John Peacock + + Initial revision + Added: trunk/orca/packages/version-0.39/MANIFEST ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/MANIFEST Sat Jun 5 23:02:34 2004 @@ -0,0 +1,11 @@ +Makefile.PL +MANIFEST +README +t/01base.t +lib/version.pm +version.xs +util.c +util.h +ppport.h +typemap +META.yml Module meta-data (added by MakeMaker) Added: trunk/orca/packages/version-0.39/META.yml ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/META.yml Sat Jun 5 23:02:34 2004 @@ -0,0 +1,11 @@ +# http://module-build.sourceforge.net/META-spec.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +name: version +version: 0.39 +version_from: lib/version.pm +installdirs: site +requires: + Test::More: 0.45 + +distribution_type: module +generated_by: ExtUtils::MakeMaker version 6.21 Added: trunk/orca/packages/version-0.39/Makefile.PL ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/Makefile.PL Sat Jun 5 23:02:34 2004 @@ -0,0 +1,17 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'NAME' => 'version', + 'VERSION_FROM' => 'lib/version.pm', # finds $VERSION + 'PREREQ_PM' => {Test::More => 0.45}, # e.g., Module::Name => 1.1 + 'LIBS' => [''], # e.g., '-lm' + 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' + # Insert -I. if you add *.h files later: + 'INC' => '', # e.g., '-I/usr/include/other' + # Un-comment this if you add C files to link with later: + 'OBJECT' => '$(O_FILES)', # link all the C files too + dist => { + PREOP => 'svn log | gnuify-changelog.pl > ${DISTVNAME}/Changes', + }, +); Added: trunk/orca/packages/version-0.39/README ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/README Sat Jun 5 23:02:34 2004 @@ -0,0 +1,50 @@ +version 0.39 +==================== + +Provides the same version objects as included in Perl v5.9.0 (and hopefully in +the 5.10.0 release). In fact, if you attempt to use this module with a version +of Perl >= v5.9.0, this module will not do anything, since the code already +exists in the Perl core. + +This release changes the behavior of alpha versions with only 1 decimal +place, to make them behave more like their floating-point counterparts. +This may lead to some confusion over the stringified representation of +alpha versions. See the POD for more details. + +IMPORTANT NOTE: version-0.37 introduced a segfault when trying to use the +UNIVERSAL::VERSION routine on modules without a $VERSION scalar. This was +fixed in version-0.38. + +IMPORTANT NOTE2: This version changes the default stringification for some +version objects. Be sure and read the updated POD for details. This also +affect the return value of the replacement UNIVERSAL::VERSION method. + +IMPORTANT NOTE3: The replacement UNIVERSAL::VERSION method supplied by this +module currently leaks memory, so don't call it in a loop in your code +until this has been corrected (this is a very uncommon mode of operation, +so it is not as serious a problem as it could be otherwise). + +NOT SO IMPORTANT NOTE: The version::AlphaBeta module has been removed from +this distribution and released independently on CPAN. + +Please read the POD documentation for usage/details. + +INSTALLATION + +To install this module type the following: + + perl Makefile.PL + make + make test + make install + +DEPENDENCIES + +the same C compiler used to build Perl + +COPYRIGHT AND LICENCE + +This module can be distributed under the same terms as Perl. + +Copyright (C) 2004 John Peacock + Added: trunk/orca/packages/version-0.39/lib/version.pm ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/lib/version.pm Sat Jun 5 23:02:34 2004 @@ -0,0 +1,531 @@ +#!perl -w +package version; + +use 5.005_03; +use strict; + +require Exporter; +require DynaLoader; +use vars qw(@ISA $VERSION $CLASS @EXPORT); + + at ISA = qw(Exporter DynaLoader); + + at EXPORT = qw(qv); + +$VERSION = 0.39; # stop using CVS and switch to subversion + +$CLASS = 'version'; + +local $^W; # shut up the 'redefined' warning for UNIVERSAL::VERSION +bootstrap version if $] < 5.009; + +# Preloaded methods go here. + +1; +__END__ + +=head1 NAME + +version - Perl extension for Version Objects + +=head1 SYNOPSIS + + use version; + $version = version->new("12.2.1"); # must be quoted for Perl < 5.8.1 + print $version; # 12.2.1 + print $version->numify; # 12.002001 + if ( $version gt "12.2" ) # true + + $alphaver = version->new("1.2_3"); # must be quoted! + print $alphaver; # 1.2_3 + print $alphaver->is_alpha(); # true + + $ver = qv(1.2); # 1.2.0 + $ver = qv("1.2"); # 1.2.0 + + $perlver = version->new(5.005_03); # must not be quoted! + print $perlver; # 5.5.30 + +=head1 DESCRIPTION + +Overloaded version objects for all versions of Perl. This module +implements all of the features of version objects which will be part +of Perl 5.10.0 except automatic version object creation. + +=head2 What IS a version + +For the purposes of this module, a version "number" is a sequence of +positive integral values separated by decimal points and optionally a +single underscore. This corresponds to what Perl itself uses for a +version, as well as extending the "version as number" that is discussed +in the various editions of the Camel book. + +There are actually two distinct ways to initialize versions: + +=over 4 + +=item * Numeric Versions + +Any initial parameter which "looks like a number", see L. + +=item * Quoted Versions + +Any initial parameter which contains more than one decimal point +or contains an embedded underscore, see L. The +most recent development version of Perl (5.9.x) and the next major +release (5.10.0) will automatically create version objects for bare +numbers containing more than one decimal point in the appropriate +context. + +=back + +Both of these methods will produce similar version objects, in that +the default stringification will yield the version L only +if required: + + $v = version->new(1.002); # 1.002, but compares like 1.2.0 + $v = version->new(1.002003); # 1.2.3 + $v2 = version->new( "1.2.3"); # 1.2.3 + $v3 = version->new( 1.2.3); # 1.2.3 for Perl >= 5.8.1 + +Please see L<"Quoting"> for more details on how Perl will parse various +input values. + +Any value passed to the new() operator will be parsed only so far as it +contains a numeric, decimal, or underscore character. So, for example: + + $v1 = version->new("99 and 94/100 percent pure"); # $v1 == 99.0 + $v2 = version->new("something"); # $v2 == "" and $v2->numify == 0 + +However, see L for one case where non-numeric text is +acceptable when initializing version objects. + +=head2 What about v-strings? + +Beginning with Perl 5.6.0, an alternate method to code arbitrary strings +of bytes was introduced, called v-strings. They were intended to be an +easy way to enter, for example, Unicode strings (which contain two bytes +per character). Some programs have used them to encode printer control +characters (e.g. CRLF). They were also intended to be used for $VERSION. +Their use has been problematic from the start and they will be phased out +beginning in Perl 5.10.0. + +There are two ways to enter v-strings: a bare number with two or more +decimal places, or a bare number with one or more decimal places and a +leading 'v' character (also bare). For example: + + $vs1 = 1.2.3; # encoded as \1\2\3 + $vs2 = v1.2; # encoded as \1\2 + +The first of those two syntaxes is destined to be the default way to create +a version object in 5.10.0, whereas the second will issue a mandatory +deprecation warning beginning at the same time. In both cases, a v-string +encoded version will always be stringified in the version L. + +Consequently, the use of v-strings to initialize version objects with +this module is only possible with Perl 5.8.1 or better (which contain special +code to enable it). Their use is B discouraged in all +circumstances (especially the leading 'v' style), since the meaning will +change depending on which Perl you are running. It is better to use +L<"Quoted Versions"> to ensure the proper interpretation. + +=head2 Numeric Versions + +These correspond to historical versions of Perl itself prior to 5.6.0, +as well as all other modules which follow the Camel rules for the +$VERSION scalar. A numeric version is initialized with what looks like +a floating point number. Leading zeros B significant and trailing +zeros are implied so that a minimum of three places is maintained +between subversions. What this means is that any subversion (digits +to the right of the decimal place) that contains less than three digits +will have trailing zeros added to make up the difference, but only for +purposes of comparison with other version objects. For example: + + $v = version->new( 1.2); # prints 1.2, compares as 1.200.0 + $v = version->new( 1.02); # prints 1.02, compares as 1.20.0 + $v = version->new( 1.002); # prints 1.002, compares as 1.2.0 + $v = version->new( 1.0023); # 1.2.300 + $v = version->new( 1.00203); # 1.2.30 + $v = version->new( 1.002_03); # 1.2.30 See "Quoting" + $v = version->new( 1.002003); # 1.2.3 + +All of the preceeding examples except the second to last are true +whether or not the input value is quoted. The important feature is that +the input value contains only a single decimal. + +IMPORTANT NOTE: If your numeric version contains more than 3 significant +digits after the decimal place, it will be split on each multiple of 3, so +1.0003 becomes 1.0.300, due to the need to remain compatible with Perl's +own 5.005_03 == 5.5.30 interpretation. + +=head2 Quoted Versions + +These are the newest form of versions, and correspond to Perl's own +version style beginning with 5.6.0. Starting with Perl 5.10.0, +and most likely Perl 6, this is likely to be the preferred form. This +method requires that the input parameter be quoted, although Perl's after +5.9.0 can use bare numbers with multiple decimal places as a special form +of quoting. + +Unlike L, Quoted Versions may have more than +a single decimal point, e.g. "5.6.1" (for all versions of Perl). If a +Quoted Version has only one decimal place (and no embedded underscore), +it is interpreted exactly like a L. + +So, for example: + + $v = version->new( "1.002"); # 1.2 + $v = version->new( "1.2.3"); # 1.2.3 + $v = version->new("1.0003"); # 1.0.300 + +In addition to conventional versions, Quoted Versions can be +used to create L. + +In general, Quoted Versions permit the greatest amount of freedom +to specify a version, whereas Numeric Versions enforce a certain +uniformity. See also L for an additional method of +initializing version objects. + +=head2 Object Methods + +Overloading has been used with version objects to provide a natural +interface for their use. All mathematical operations are forbidden, +since they don't make any sense for base version objects. + +=over 4 + +=item * New Operator + +Like all OO interfaces, the new() operator is used to initialize +version objects. One way to increment versions when programming is to +use the CVS variable $Revision, which is automatically incremented by +CVS every time the file is committed to the repository. + +In order to facilitate this feature, the following +code can be employed: + + $VERSION = version->new(qw$Revision: 2.7 $); + +and the version object will be created as if the following code +were used: + + $VERSION = version->new("v2.7"); + +In other words, the version will be automatically parsed out of the +string, and it will be quoted to preserve the meaning CVS normally +carries for versions. The CVS $Revision$ increments differently from +numeric versions (i.e. 1.10 follows 1.9), so it must be handled as if +it were a L. + +New in 0.38, a new version object can be created as a copy of an existing +version object: + + $v1 = version->new(12.3); + $v2 = version->new($v1); + +and $v1 and $v2 will be identical. + +=back + +=over 4 + +=item * qv() + +An alternate way to create a new version object is through the exported +qv() sub. This is not strictly like other q? operators (like qq, qw), +in that the only delimiters supported are parentheses (or spaces). It is +the best way to initialize a short version without triggering the floating +point interpretation. For example: + + $v1 = qv(1.2); # 1.2.0 + $v2 = qv("1.2"); # also 1.2.0 + +As you can see, either a bare number or a quoted string can be used, and +either will yield the same version number. + +=back + +For the subsequent examples, the following three objects will be used: + + $ver = version->new("1.2.3.4"); # see "Quoting" below + $alpha = version->new("1.2.3_4"); # see "Alpha versions" below + $nver = version->new(1.2); # see "Numeric Versions" above + +=over 4 + +=item * Normal Form + +For any version object which is initialized with multiple decimal +places (either quoted or if possible v-string), or initialized using +the L operator, the stringified representation is returned in +a normalized or reduced form (no extraneous zeros): + + print $ver->normal; # prints as 1.2.3 + print $ver->stringify; # ditto + print $ver; # ditto + print $nver->normal; # prints as 1.2.0 + print $nver->stringify; # prints as 1.2, see "Stringification" + +In order to preserve the meaning of the processed version, the +normalized representation will always contain at least three sub terms. +In other words, the following is guaranteed to always be true: + + my $newver = version->new($ver->stringify); + if ($newver eq $ver ) # always true + {...} + +=back + +=over 4 + +=item * Numification + +Although all mathematical operations on version objects are forbidden +by default, it is possible to retrieve a number which roughly +corresponds to the version object through the use of the $obj->numify +method. For formatting purposes, when displaying a number which +corresponds a version object, all sub versions are assumed to have +three decimal places. So for example: + + print $ver->numify; # prints 1.002003 + print $nver->numify; # prints 1.2 + +Unlike the stringification operator, there is never any need to append +trailing zeros to preserve the correct version value. + +=back + +=over 4 + +=item * Stringification + +In order to mirror as much as possible the existing behavior of ordinary +$VERSION scalars, the stringification operation will display differently, +depending on whether the version was initialized as a L +or L. + +What this means in practice is that if the normal CPAN and Camel rules are +followed ($VERSION is a floating point number with no more than 3 decimal +places), the stringified output will be exactly the same as the numified +output. There will be no visible difference, although the internal +representation will be different, and the L will +function using the internal coding. + +If a version object is initialized using a L form, or if +the number of significant decimal places exceed three, then the stringified +form will be the L. The $obj->normal operation can always be +used to produce the L, even if the version was originally a +L. + + print $ver->stringify; # prints 1.2.3 + print $nver->stringify; # prints 1.2 + +=back + +=over 4 + +=item * Comparison operators + +Both cmp and <=> operators perform the same comparison between terms +(upgrading to a version object automatically). Perl automatically +generates all of the other comparison operators based on those two. +In addition to the obvious equalities listed below, appending a single +trailing 0 term does not change the value of a version for comparison +purposes. In other words "v1.2" and "1.2.0" will compare as identical. + +For example, the following relations hold: + + As Number As String Truth Value + --------- ------------ ----------- + $ver > 1.0 $ver gt "1.0" true + $ver < 2.5 $ver lt true + $ver != 1.3 $ver ne "1.3" true + $ver == 1.2 $ver eq "1.2" false + $ver == 1.2.3 $ver eq "1.2.3" see discussion below + +It is probably best to chose either the numeric notation or the string +notation and stick with it, to reduce confusion. Perl6 version objects +B only support numeric comparisons. See also L<"Quoting">. + +WARNING: Comparing version with unequal numbers of decimal places (whether +explicitely or implicitely initialized), may yield unexpected results at +first glance. For example, the following inequalities hold: + + version->new(0.96) > version->new(0.95); # 0.960.0 > 0.950.0 + version->new("0.96.1") < version->new(0.95); # 0.096.1 < 0.950.0 + +For this reason, it is best to use either exclusively L or +L with multiple decimal places. + +=back + +=over 4 + +=item * Logical Operators + +If you need to test whether a version object +has been initialized, you can simply test it directly: + + $vobj = version->new($something); + if ( $vobj ) # true only if $something was non-blank + +You can also test whether a version object is an L, for +example to prevent the use of some feature not present in the main +release: + + $vobj = version->new("1.2_3"); # MUST QUOTE + ...later... + if ( $vobj->is_alpha ) # True + +=back + +=head2 Quoting + +Because of the nature of the Perl parsing and tokenizing routines, +certain initialization values B be quoted in order to correctly +parse as the intended version, and additionally, some initial values +B be quoted to obtain the intended version. + +Except for L, any version initialized with something +that looks like a number (a single decimal place) will be parsed in +the same way whether or not the term is quoted. In order to be +compatible with earlier Perl version styles, any use of versions of +the form 5.006001 will be translated as 5.6.1. In other words, a +version with a single decimal place will be parsed as implicitly +having three places between subversions. + +The complicating factor is that in bare numbers (i.e. unquoted), the +underscore is a legal numeric character and is automatically stripped +by the Perl tokenizer before the version code is called. However, if +a number containing one or more decimals and an underscore is quoted, i.e. +not bare, that is considered a L and the underscore is +significant. + +If you use a mathematic formula that resolves to a floating point number, +you are dependent on Perl's conversion routines to yield the version you +expect. You are pretty safe by dividing by a power of 10, for example, +but other operations are not likely to be what you intend. For example: + + $VERSION = version->new((qw$Revision: 1.4)[1]/10); + print $VERSION; # yields 0.14 + $V2 = version->new(100/9); # Integer overflow in decimal number + print $V2; # yields something like 11.111.111.100 + +Perl 5.8.1 and beyond will be able to automatically quote v-strings +(although a warning may be issued under 5.9.x and 5.10.0), but that +is not possible in earlier versions of Perl. In other words: + + $version = version->new("v2.5.4"); # legal in all versions of Perl + $newvers = version->new(v2.5.4); # legal only in Perl >= 5.8.1 + + +=head2 Types of Versions Objects + +There are two types of Version Objects: + +=over 4 + +=item * Ordinary versions + +These are the versions that normal modules will use. Can contain as +many subversions as required. In particular, those using RCS/CVS can +use the following: + + $VERSION = version->new(qw$Revision: 2.7 $); + +and the current RCS Revision for that file will be inserted +automatically. If the file has been moved to a branch, the Revision +will have three or more elements; otherwise, it will have only two. +This allows you to automatically increment your module version by +using the Revision number from the primary file in a distribution, see +L. + +=item * Alpha versions + +For module authors using CPAN, the convention has been to note +unstable releases with an underscore in the version string, see +L. Alpha releases will test as being newer than the more recent +stable release, and less than the next stable release. For example: + + $alphaver = version->new("12.3_1"); # must quote + +obeys the relationship + + 12.3 < $alphaver < 12.4 + +As a matter of fact, if is also true that + + 12.3.0 < $alphaver < 12.3.1 + +where the subversion is identical but the alpha release is less than +the non-alpha release. + +Alpha versions with a single decimal place will be treated exactly as if +they were L, for parsing purposes. The stringification for +alpha versions with a single decimal place may seem suprising, since any +trailing zeros will visible. For example, the above $alphaver will print as + + 12.300_100 + +Alpha versions with more than a single decimal place will be treated +exactly as if they were L, and will display without any +trailing (or leading) zeros, in the L form. For example, + + $newver = version->new("12.3.1_1"); + print $newver; # 12.3.1_1 + +=head2 Replacement UNIVERSAL::VERSION + +In addition to the version objects, this modules also replaces the core +UNIVERSAL::VERSION function with one that uses version objects for its +comparisons. The return from this operator is always the numified form, +and the warning message generated includes both the numified and normal +forms (for clarity). + +For example: + + package Foo; + $VERSION = 1.2; + + package Bar; + $VERSION = "1.3.5"; # works with all Perl's (since it is quoted) + + package main; + use version; + + print $Foo::VERSION; # prints 1.2 + + print $Bar::VERSION; # prints 1.003005 + + eval "use CGI 10"; # some far future release + print $@; # prints "CGI version 10 (10.0.0) required..." + +IMPORTANT NOTE: This may mean that code which searches for a specific +string (to determine whether a given module is available) may need to be +changed. + +The replacement UNIVERSAL::VERSION, when used as a function, like this: + + print $module->VERSION; + +will follow the stringification rules; i.e. Numeric versions will be displayed +with the numified format, and the rest will be displayed with the Normal +format. Technically, the $module->VERSION function returns a string (PV) that +can be converted to a number following the normal Perl rules, when used in a +numeric context. + + +=head1 EXPORT + +qv - quoted version initialization operator + +=head1 AUTHOR + +John Peacock Ejpeacock at rowman.comE + +=head1 SEE ALSO + +L. + +=cut Added: trunk/orca/packages/version-0.39/ppport.h ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/ppport.h Sat Jun 5 23:02:34 2004 @@ -0,0 +1,1098 @@ + +/* ppport.h -- Perl/Pollution/Portability Version 2.011_02 + * + * Automatically Created by Devel::PPPort on Tue Mar 23 21:50:21 2004 + * + * Do NOT edit this file directly! -- Edit PPPort.pm instead. + * + * Version 2.x, Copyright (C) 2001, Paul Marquess. + * Version 1.x, Copyright (C) 1999, Kenneth Albanowski. + * This code may be used and distributed under the same license as any + * version of Perl. + * + * This version of ppport.h is designed to support operation with Perl + * installations back to 5.004, and has been tested up to 5.8.1. + * + * If this version of ppport.h is failing during the compilation of this + * module, please check if a newer version of Devel::PPPort is available + * on CPAN before sending a bug report. + * + * If you are using the latest version of Devel::PPPort and it is failing + * during compilation of this module, please send a report to perlbug at perl.com + * + * Include all following information: + * + * 1. The complete output from running "perl -V" + * + * 2. This file. + * + * 3. The name & version of the module you were trying to build. + * + * 4. A full log of the build that failed. + * + * 5. Any other information that you think could be relevant. + * + * + * For the latest version of this code, please retreive the Devel::PPPort + * module from CPAN. + * + */ + +/* + * In order for a Perl extension module to be as portable as possible + * across differing versions of Perl itself, certain steps need to be taken. + * Including this header is the first major one, then using dTHR is all the + * appropriate places and using a PL_ prefix to refer to global Perl + * variables is the second. + * + */ + + +/* If you use one of a few functions that were not present in earlier + * versions of Perl, please add a define before the inclusion of ppport.h + * for a static include, or use the GLOBAL request in a single module to + * produce a global definition that can be referenced from the other + * modules. + * + * Function: Static define: Extern define: + * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL + * + */ + + +/* To verify whether ppport.h is needed for your module, and whether any + * special defines should be used, ppport.h can be run through Perl to check + * your source code. Simply say: + * + * perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc] + * + * The result will be a list of patches suggesting changes that should at + * least be acceptable, if not necessarily the most efficient solution, or a + * fix for all possible problems. It won't catch where dTHR is needed, and + * doesn't attempt to account for global macro or function definitions, + * nested includes, typemaps, etc. + * + * In order to test for the need of dTHR, please try your module under a + * recent version of Perl that has threading compiled-in. + * + */ + + +/* +#!/usr/bin/perl + at ARGV = ("*.xs") if !@ARGV; +%badmacros = %funcs = %macros = (); $replace = 0; +foreach () { + $funcs{$1} = 1 if /Provide:\s+(\S+)/; + $macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/; + $replace = $1 if /Replace:\s+(\d+)/; + $badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/; + $badmacros{$1}=$2 if /Replace (\S+) with (\S+)/; +} +foreach $filename (map(glob($_), at ARGV)) { + unless (open(IN, "<$filename")) { + warn "Unable to read from $file: $!\n"; + next; + } + print "Scanning $filename...\n"; + $c = ""; while () { $c .= $_; } close(IN); + $need_include = 0; %add_func = (); $changes = 0; + $has_include = ($c =~ /#.*include.*ppport/m); + + foreach $func (keys %funcs) { + if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) { + if ($c !~ /\b$func\b/m) { + print "If $func isn't needed, you don't need to request it.\n" if + $changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m); + } else { + print "Uses $func\n"; + $need_include = 1; + } + } else { + if ($c =~ /\b$func\b/m) { + $add_func{$func} =1 ; + print "Uses $func\n"; + $need_include = 1; + } + } + } + + if (not $need_include) { + foreach $macro (keys %macros) { + if ($c =~ /\b$macro\b/m) { + print "Uses $macro\n"; + $need_include = 1; + } + } + } + + foreach $badmacro (keys %badmacros) { + if ($c =~ /\b$badmacro\b/m) { + $changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm); + print "Uses $badmacros{$badmacro} (instead of $badmacro)\n"; + $need_include = 1; + } + } + + if (scalar(keys %add_func) or $need_include != $has_include) { + if (!$has_include) { + $inc = join('',map("#define NEED_$_\n", sort keys %add_func)). + "#include \"ppport.h\"\n"; + $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m; + } elsif (keys %add_func) { + $inc = join('',map("#define NEED_$_\n", sort keys %add_func)); + $c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m; + } + if (!$need_include) { + print "Doesn't seem to need ppport.h.\n"; + $c =~ s/^.*#.*include.*ppport.*\n//m; + } + $changes++; + } + + if ($changes) { + open(OUT,"ppport.h.$$"); + print OUT $c; + close(OUT); + open(DIFF, "diff -u $filename ppport.h.$$|"); + while () { s!ppport\.h\.$$!$filename.patched!; print STDOUT; } + close(DIFF); + unlink("ppport.h.$$"); + } else { + print "Looks OK\n"; + } +} +__DATA__ +*/ + +#ifndef _P_P_PORTABILITY_H_ +#define _P_P_PORTABILITY_H_ + +#ifndef PERL_REVISION +# ifndef __PATCHLEVEL_H_INCLUDED__ +# define PERL_PATCHLEVEL_H_IMPLICIT +# include +# endif +# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) +# include +# endif +# ifndef PERL_REVISION +# define PERL_REVISION (5) + /* Replace: 1 */ +# define PERL_VERSION PATCHLEVEL +# define PERL_SUBVERSION SUBVERSION + /* Replace PERL_PATCHLEVEL with PERL_VERSION */ + /* Replace: 0 */ +# endif +#endif + +#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) + +/* It is very unlikely that anyone will try to use this with Perl 6 + (or greater), but who knows. + */ +#if PERL_REVISION != 5 +# error ppport.h only works with Perl version 5 +#endif /* PERL_REVISION != 5 */ + +#ifndef ERRSV +# define ERRSV perl_get_sv("@",FALSE) +#endif + +#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)) +/* Replace: 1 */ +# define PL_Sv Sv +# define PL_compiling compiling +# define PL_copline copline +# define PL_curcop curcop +# define PL_curstash curstash +# define PL_defgv defgv +# define PL_dirty dirty +# define PL_dowarn dowarn +# define PL_hints hints +# define PL_na na +# define PL_perldb perldb +# define PL_rsfp_filters rsfp_filters +# define PL_rsfpv rsfp +# define PL_stdingv stdingv +# define PL_sv_no sv_no +# define PL_sv_undef sv_undef +# define PL_sv_yes sv_yes +/* Replace: 0 */ +#endif + +#ifdef HASATTRIBUTE +# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) +# define PERL_UNUSED_DECL +# else +# define PERL_UNUSED_DECL __attribute__((unused)) +# endif +#else +# define PERL_UNUSED_DECL +#endif + +#ifndef dNOOP +# define NOOP (void)0 +# define dNOOP extern int Perl___notused PERL_UNUSED_DECL +#endif + +#ifndef dTHR +# define dTHR dNOOP +#endif + +#ifndef dTHX +# define dTHX dNOOP +# define dTHXa(x) dNOOP +# define dTHXoa(x) dNOOP +#endif + +#ifndef pTHX +# define pTHX void +# define pTHX_ +# define aTHX +# define aTHX_ +#endif + +#ifndef dAX +# define dAX I32 ax = MARK - PL_stack_base + 1 +#endif +#ifndef dITEMS +# define dITEMS I32 items = SP - MARK +#endif + +/* IV could also be a quad (say, a long long), but Perls + * capable of those should have IVSIZE already. */ +#if !defined(IVSIZE) && defined(LONGSIZE) +# define IVSIZE LONGSIZE +#endif +#ifndef IVSIZE +# define IVSIZE 4 /* A bold guess, but the best we can make. */ +#endif + +#ifndef UVSIZE +# define UVSIZE IVSIZE +#endif + +#ifndef NVTYPE +# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) +# define NVTYPE long double +# else +# define NVTYPE double +# endif +typedef NVTYPE NV; +#endif + +#ifndef INT2PTR + +#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) +# define PTRV UV +# define INT2PTR(any,d) (any)(d) +#else +# if PTRSIZE == LONGSIZE +# define PTRV unsigned long +# else +# define PTRV unsigned +# endif +# define INT2PTR(any,d) (any)(PTRV)(d) +#endif +#define NUM2PTR(any,d) (any)(PTRV)(d) +#define PTR2IV(p) INT2PTR(IV,p) +#define PTR2UV(p) INT2PTR(UV,p) +#define PTR2NV(p) NUM2PTR(NV,p) +#if PTRSIZE == LONGSIZE +# define PTR2ul(p) (unsigned long)(p) +#else +# define PTR2ul(p) INT2PTR(unsigned long,p) +#endif + +#endif /* !INT2PTR */ + +#ifndef boolSV +# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) +#endif + +#ifndef gv_stashpvn +# define gv_stashpvn(str,len,flags) gv_stashpv(str,flags) +#endif + +#ifndef newSVpvn +# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) +#endif + +#ifndef newRV_inc +/* Replace: 1 */ +# define newRV_inc(sv) newRV(sv) +/* Replace: 0 */ +#endif + +/* DEFSV appears first in 5.004_56 */ +#ifndef DEFSV +# define DEFSV GvSV(PL_defgv) +#endif + +#ifndef SAVE_DEFSV +# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) +#endif + +#ifndef newRV_noinc +# ifdef __GNUC__ +# define newRV_noinc(sv) \ + ({ \ + SV *nsv = (SV*)newRV(sv); \ + SvREFCNT_dec(sv); \ + nsv; \ + }) +# else +# if defined(USE_THREADS) +static SV * newRV_noinc (SV * sv) +{ + SV *nsv = (SV*)newRV(sv); + SvREFCNT_dec(sv); + return nsv; +} +# else +# define newRV_noinc(sv) \ + (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv) +# endif +# endif +#endif + +/* Provide: newCONSTSUB */ + +/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ +#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63)) + +#if defined(NEED_newCONSTSUB) +static +#else +extern void newCONSTSUB(HV * stash, char * name, SV *sv); +#endif + +#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) +void +newCONSTSUB(stash,name,sv) +HV *stash; +char *name; +SV *sv; +{ + U32 oldhints = PL_hints; + HV *old_cop_stash = PL_curcop->cop_stash; + HV *old_curstash = PL_curstash; + line_t oldline = PL_curcop->cop_line; + PL_curcop->cop_line = PL_copline; + + PL_hints &= ~HINT_BLOCK_SCOPE; + if (stash) + PL_curstash = PL_curcop->cop_stash = stash; + + newSUB( + +#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22)) + /* before 5.003_22 */ + start_subparse(), +#else +# if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22) + /* 5.003_22 */ + start_subparse(0), +# else + /* 5.003_23 onwards */ + start_subparse(FALSE, 0), +# endif +#endif + + newSVOP(OP_CONST, 0, newSVpv(name,0)), + newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ + newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) + ); + + PL_hints = oldhints; + PL_curcop->cop_stash = old_cop_stash; + PL_curstash = old_curstash; + PL_curcop->cop_line = oldline; +} +#endif + +#endif /* newCONSTSUB */ + +#ifndef START_MY_CXT + +/* + * Boilerplate macros for initializing and accessing interpreter-local + * data from C. All statics in extensions should be reworked to use + * this, if you want to make the extension thread-safe. See ext/re/re.xs + * for an example of the use of these macros. + * + * Code that uses these macros is responsible for the following: + * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" + * 2. Declare a typedef named my_cxt_t that is a structure that contains + * all the data that needs to be interpreter-local. + * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. + * 4. Use the MY_CXT_INIT macro such that it is called exactly once + * (typically put in the BOOT: section). + * 5. Use the members of the my_cxt_t structure everywhere as + * MY_CXT.member. + * 6. Use the dMY_CXT macro (a declaration) in all the functions that + * access MY_CXT. + */ + +#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ + defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) + +/* This must appear in all extensions that define a my_cxt_t structure, + * right after the definition (i.e. at file scope). The non-threads + * case below uses it to declare the data as static. */ +#define START_MY_CXT + +#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 )) +/* Fetches the SV that keeps the per-interpreter data. */ +#define dMY_CXT_SV \ + SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE) +#else /* >= perl5.004_68 */ +#define dMY_CXT_SV \ + SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ + sizeof(MY_CXT_KEY)-1, TRUE) +#endif /* < perl5.004_68 */ + +/* This declaration should be used within all functions that use the + * interpreter-local data. */ +#define dMY_CXT \ + dMY_CXT_SV; \ + my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) + +/* Creates and zeroes the per-interpreter data. + * (We allocate my_cxtp in a Perl SV so that it will be released when + * the interpreter goes away.) */ +#define MY_CXT_INIT \ + dMY_CXT_SV; \ + /* newSV() allocates one more than needed */ \ + my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ + Zero(my_cxtp, 1, my_cxt_t); \ + sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) + +/* This macro must be used to access members of the my_cxt_t structure. + * e.g. MYCXT.some_data */ +#define MY_CXT (*my_cxtp) + +/* Judicious use of these macros can reduce the number of times dMY_CXT + * is used. Use is similar to pTHX, aTHX etc. */ +#define pMY_CXT my_cxt_t *my_cxtp +#define pMY_CXT_ pMY_CXT, +#define _pMY_CXT ,pMY_CXT +#define aMY_CXT my_cxtp +#define aMY_CXT_ aMY_CXT, +#define _aMY_CXT ,aMY_CXT + +#else /* single interpreter */ + +#define START_MY_CXT static my_cxt_t my_cxt; +#define dMY_CXT_SV dNOOP +#define dMY_CXT dNOOP +#define MY_CXT_INIT NOOP +#define MY_CXT my_cxt + +#define pMY_CXT void +#define pMY_CXT_ +#define _pMY_CXT +#define aMY_CXT +#define aMY_CXT_ +#define _aMY_CXT + +#endif + +#endif /* START_MY_CXT */ + +#ifndef IVdf +# if IVSIZE == LONGSIZE +# define IVdf "ld" +# define UVuf "lu" +# define UVof "lo" +# define UVxf "lx" +# define UVXf "lX" +# else +# if IVSIZE == INTSIZE +# define IVdf "d" +# define UVuf "u" +# define UVof "o" +# define UVxf "x" +# define UVXf "X" +# endif +# endif +#endif + +#ifndef NVef +# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ + defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ +# define NVef PERL_PRIeldbl +# define NVff PERL_PRIfldbl +# define NVgf PERL_PRIgldbl +# else +# define NVef "e" +# define NVff "f" +# define NVgf "g" +# endif +#endif + +#ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */ +# define AvFILLp AvFILL +#endif + +#ifdef SvPVbyte +# if PERL_REVISION == 5 && PERL_VERSION < 7 + /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */ +# undef SvPVbyte +# define SvPVbyte(sv, lp) \ + ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ + ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp)) + static char * + my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp) + { + sv_utf8_downgrade(sv,0); + return SvPV(sv,*lp); + } +# endif +#else +# define SvPVbyte SvPV +#endif + +#ifndef SvPV_nolen +# define SvPV_nolen(sv) \ + ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ + ? SvPVX(sv) : sv_2pv_nolen(sv)) + static char * + sv_2pv_nolen(pTHX_ register SV *sv) + { + STRLEN n_a; + return sv_2pv(sv, &n_a); + } +#endif + +#ifndef get_cv +# define get_cv(name,create) perl_get_cv(name,create) +#endif + +#ifndef get_sv +# define get_sv(name,create) perl_get_sv(name,create) +#endif + +#ifndef get_av +# define get_av(name,create) perl_get_av(name,create) +#endif + +#ifndef get_hv +# define get_hv(name,create) perl_get_hv(name,create) +#endif + +#ifndef call_argv +# define call_argv perl_call_argv +#endif + +#ifndef call_method +# define call_method perl_call_method +#endif + +#ifndef call_pv +# define call_pv perl_call_pv +#endif + +#ifndef call_sv +# define call_sv perl_call_sv +#endif + +#ifndef eval_pv +# define eval_pv perl_eval_pv +#endif + +#ifndef eval_sv +# define eval_sv perl_eval_sv +#endif + +#ifndef PERL_SCAN_GREATER_THAN_UV_MAX +# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 +#endif + +#ifndef PERL_SCAN_SILENT_ILLDIGIT +# define PERL_SCAN_SILENT_ILLDIGIT 0x04 +#endif + +#ifndef PERL_SCAN_ALLOW_UNDERSCORES +# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 +#endif + +#ifndef PERL_SCAN_DISALLOW_PREFIX +# define PERL_SCAN_DISALLOW_PREFIX 0x02 +#endif + +#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1)) +#define I32_CAST +#else +#define I32_CAST (I32*) +#endif + +#ifndef grok_hex +static UV _grok_hex (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_hex(string, *len, I32_CAST len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_hex(string, len, flags, result) \ + _grok_hex(pTHX_ (string), (len), (flags), (result)) +#endif + +#ifndef grok_oct +static UV _grok_oct (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_oct(string, *len, I32_CAST len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_oct(string, len, flags, result) \ + _grok_oct(pTHX_ (string), (len), (flags), (result)) +#endif + +#if !defined(grok_bin) && defined(scan_bin) +static UV _grok_bin (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) { + NV r = scan_bin(string, *len, I32_CAST len); + if (r > UV_MAX) { + *flags |= PERL_SCAN_GREATER_THAN_UV_MAX; + if (result) *result = r; + return UV_MAX; + } + return (UV)r; +} + +# define grok_bin(string, len, flags, result) \ + _grok_bin(pTHX_ (string), (len), (flags), (result)) +#endif + +#ifndef IN_LOCALE +# define IN_LOCALE \ + (PL_curcop == &PL_compiling ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) +#endif + +#ifndef IN_LOCALE_RUNTIME +# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) +#endif + +#ifndef IN_LOCALE_COMPILETIME +# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) +#endif + + +#ifndef IS_NUMBER_IN_UV +# define IS_NUMBER_IN_UV 0x01 +# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 +# define IS_NUMBER_NOT_INT 0x04 +# define IS_NUMBER_NEG 0x08 +# define IS_NUMBER_INFINITY 0x10 +# define IS_NUMBER_NAN 0x20 +#endif + +#ifndef grok_numeric_radix +# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(aTHX_ sp, send) + +#define grok_numeric_radix Perl_grok_numeric_radix + +static +bool +Perl_grok_numeric_radix(pTHX_ const char **sp, const char *send) +{ +#ifdef USE_LOCALE_NUMERIC +#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1)) + if (PL_numeric_radix_sv && IN_LOCALE) { + STRLEN len; + char* radix = SvPV(PL_numeric_radix_sv, len); + if (*sp + len <= send && memEQ(*sp, radix, len)) { + *sp += len; + return TRUE; + } + } +#else + /* pre5.6.0 perls don't have PL_numeric_radix_sv so the radix + * must manually be requested from locale.h */ +#include + struct lconv *lc = localeconv(); + char *radix = lc->decimal_point; + if (radix && IN_LOCALE) { + STRLEN len = strlen(radix); + if (*sp + len <= send && memEQ(*sp, radix, len)) { + *sp += len; + return TRUE; + } + } +#endif /* PERL_VERSION */ +#endif /* USE_LOCALE_NUMERIC */ + /* always try "." if numeric radix didn't match because + * we may have data from different locales mixed */ + if (*sp < send && **sp == '.') { + ++*sp; + return TRUE; + } + return FALSE; +} +#endif /* grok_numeric_radix */ + +#ifndef grok_number + +#define grok_number Perl_grok_number + +static +int +Perl_grok_number(pTHX_ const char *pv, STRLEN len, UV *valuep) +{ + const char *s = pv; + const char *send = pv + len; + const UV max_div_10 = UV_MAX / 10; + const char max_mod_10 = UV_MAX % 10; + int numtype = 0; + int sawinf = 0; + int sawnan = 0; + + while (s < send && isSPACE(*s)) + s++; + if (s == send) { + return 0; + } else if (*s == '-') { + s++; + numtype = IS_NUMBER_NEG; + } + else if (*s == '+') + s++; + + if (s == send) + return 0; + + /* next must be digit or the radix separator or beginning of infinity */ + if (isDIGIT(*s)) { + /* UVs are at least 32 bits, so the first 9 decimal digits cannot + overflow. */ + UV value = *s - '0'; + /* This construction seems to be more optimiser friendly. + (without it gcc does the isDIGIT test and the *s - '0' separately) + With it gcc on arm is managing 6 instructions (6 cycles) per digit. + In theory the optimiser could deduce how far to unroll the loop + before checking for overflow. */ + if (++s < send) { + int digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + digit = *s - '0'; + if (digit >= 0 && digit <= 9) { + value = value * 10 + digit; + if (++s < send) { + /* Now got 9 digits, so need to check + each time for overflow. */ + digit = *s - '0'; + while (digit >= 0 && digit <= 9 + && (value < max_div_10 + || (value == max_div_10 + && digit <= max_mod_10))) { + value = value * 10 + digit; + if (++s < send) + digit = *s - '0'; + else + break; + } + if (digit >= 0 && digit <= 9 + && (s < send)) { + /* value overflowed. + skip the remaining digits, don't + worry about setting *valuep. */ + do { + s++; + } while (s < send && isDIGIT(*s)); + numtype |= + IS_NUMBER_GREATER_THAN_UV_MAX; + goto skip_value; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + numtype |= IS_NUMBER_IN_UV; + if (valuep) + *valuep = value; + + skip_value: + if (GROK_NUMERIC_RADIX(&s, send)) { + numtype |= IS_NUMBER_NOT_INT; + while (s < send && isDIGIT(*s)) /* optional digits after the radix */ + s++; + } + } + else if (GROK_NUMERIC_RADIX(&s, send)) { + numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ + /* no digits before the radix means we need digits after it */ + if (s < send && isDIGIT(*s)) { + do { + s++; + } while (s < send && isDIGIT(*s)); + if (valuep) { + /* integer approximation is valid - it's 0. */ + *valuep = 0; + } + } + else + return 0; + } else if (*s == 'I' || *s == 'i') { + s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; + s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; + s++; if (s < send && (*s == 'I' || *s == 'i')) { + s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; + s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; + s++; if (s == send || (*s != 'T' && *s != 't')) return 0; + s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; + s++; + } + sawinf = 1; + } else if (*s == 'N' || *s == 'n') { + /* XXX TODO: There are signaling NaNs and quiet NaNs. */ + s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; + s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; + s++; + sawnan = 1; + } else + return 0; + + if (sawinf) { + numtype &= IS_NUMBER_NEG; /* Keep track of sign */ + numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; + } else if (sawnan) { + numtype &= IS_NUMBER_NEG; /* Keep track of sign */ + numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; + } else if (s < send) { + /* we can have an optional exponent part */ + if (*s == 'e' || *s == 'E') { + /* The only flag we keep is sign. Blow away any "it's UV" */ + numtype &= IS_NUMBER_NEG; + numtype |= IS_NUMBER_NOT_INT; + s++; + if (s < send && (*s == '-' || *s == '+')) + s++; + if (s < send && isDIGIT(*s)) { + do { + s++; + } while (s < send && isDIGIT(*s)); + } + else + return 0; + } + } + while (s < send && isSPACE(*s)) + s++; + if (s >= send) + return numtype; + if (len == 10 && memEQ(pv, "0 but true", 10)) { + if (valuep) + *valuep = 0; + return IS_NUMBER_IN_UV; + } + return 0; +} +#endif /* grok_number */ + +#ifndef PERL_MAGIC_sv +# define PERL_MAGIC_sv '\0' +#endif + +#ifndef PERL_MAGIC_overload +# define PERL_MAGIC_overload 'A' +#endif + +#ifndef PERL_MAGIC_overload_elem +# define PERL_MAGIC_overload_elem 'a' +#endif + +#ifndef PERL_MAGIC_overload_table +# define PERL_MAGIC_overload_table 'c' +#endif + +#ifndef PERL_MAGIC_bm +# define PERL_MAGIC_bm 'B' +#endif + +#ifndef PERL_MAGIC_regdata +# define PERL_MAGIC_regdata 'D' +#endif + +#ifndef PERL_MAGIC_regdatum +# define PERL_MAGIC_regdatum 'd' +#endif + +#ifndef PERL_MAGIC_env +# define PERL_MAGIC_env 'E' +#endif + +#ifndef PERL_MAGIC_envelem +# define PERL_MAGIC_envelem 'e' +#endif + +#ifndef PERL_MAGIC_fm +# define PERL_MAGIC_fm 'f' +#endif + +#ifndef PERL_MAGIC_regex_global +# define PERL_MAGIC_regex_global 'g' +#endif + +#ifndef PERL_MAGIC_isa +# define PERL_MAGIC_isa 'I' +#endif + +#ifndef PERL_MAGIC_isaelem +# define PERL_MAGIC_isaelem 'i' +#endif + +#ifndef PERL_MAGIC_nkeys +# define PERL_MAGIC_nkeys 'k' +#endif + +#ifndef PERL_MAGIC_dbfile +# define PERL_MAGIC_dbfile 'L' +#endif + +#ifndef PERL_MAGIC_dbline +# define PERL_MAGIC_dbline 'l' +#endif + +#ifndef PERL_MAGIC_mutex +# define PERL_MAGIC_mutex 'm' +#endif + +#ifndef PERL_MAGIC_shared +# define PERL_MAGIC_shared 'N' +#endif + +#ifndef PERL_MAGIC_shared_scalar +# define PERL_MAGIC_shared_scalar 'n' +#endif + +#ifndef PERL_MAGIC_collxfrm +# define PERL_MAGIC_collxfrm 'o' +#endif + +#ifndef PERL_MAGIC_tied +# define PERL_MAGIC_tied 'P' +#endif + +#ifndef PERL_MAGIC_tiedelem +# define PERL_MAGIC_tiedelem 'p' +#endif + +#ifndef PERL_MAGIC_tiedscalar +# define PERL_MAGIC_tiedscalar 'q' +#endif + +#ifndef PERL_MAGIC_qr +# define PERL_MAGIC_qr 'r' +#endif + +#ifndef PERL_MAGIC_sig +# define PERL_MAGIC_sig 'S' +#endif + +#ifndef PERL_MAGIC_sigelem +# define PERL_MAGIC_sigelem 's' +#endif + +#ifndef PERL_MAGIC_taint +# define PERL_MAGIC_taint 't' +#endif + +#ifndef PERL_MAGIC_uvar +# define PERL_MAGIC_uvar 'U' +#endif + +#ifndef PERL_MAGIC_uvar_elem +# define PERL_MAGIC_uvar_elem 'u' +#endif + +#ifndef PERL_MAGIC_vstring +# define PERL_MAGIC_vstring 'V' +#endif + +#ifndef PERL_MAGIC_vec +# define PERL_MAGIC_vec 'v' +#endif + +#ifndef PERL_MAGIC_utf8 +# define PERL_MAGIC_utf8 'w' +#endif + +#ifndef PERL_MAGIC_substr +# define PERL_MAGIC_substr 'x' +#endif + +#ifndef PERL_MAGIC_defelem +# define PERL_MAGIC_defelem 'y' +#endif + +#ifndef PERL_MAGIC_glob +# define PERL_MAGIC_glob '*' +#endif + +#ifndef PERL_MAGIC_arylen +# define PERL_MAGIC_arylen '#' +#endif + +#ifndef PERL_MAGIC_pos +# define PERL_MAGIC_pos '.' +#endif + +#ifndef PERL_MAGIC_backref +# define PERL_MAGIC_backref '<' +#endif + +#ifndef PERL_MAGIC_ext +# define PERL_MAGIC_ext '~' +#endif + +#endif /* _P_P_PORTABILITY_H_ */ + +/* End of File ppport.h */ Added: trunk/orca/packages/version-0.39/t/01base.t ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/t/01base.t Sat Jun 5 23:02:34 2004 @@ -0,0 +1,264 @@ +#! /usr/local/perl -w +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl test.pl' + +######################### + +use Test::More tests => 168; + +diag "Tests with base class" unless $ENV{PERL_CORE}; + +use_ok("version"); # If we made it this far, we are ok. +BaseTests("version"); + +diag "Tests with empty derived class" unless $ENV{PERL_CORE}; + +package version::Empty; +use vars qw($VERSION @ISA); +use Exporter; +use version 0.30; + at ISA = qw(Exporter version); +$VERSION = 0.01; + +package main; +my $testobj = new version::Empty 1.002_003; +isa_ok( $testobj, "version::Empty" ); +ok( $testobj->numify == 1.002003, "Numified correctly" ); +ok( $testobj->stringify eq "1.2.3", "Stringified correctly" ); + +my $verobj = new version "1.2.4"; +ok( $verobj > $testobj, "Comparison vs parent class" ); +ok( $verobj gt $testobj, "Comparison vs parent class" ); +BaseTests("version::Empty"); + +sub BaseTests { + + my $CLASS = shift; + + # Insert your test code below, the Test module is use()ed here so read + # its man page ( perldoc Test ) for help writing this test script. + + # Test bare number processing + diag "tests with bare numbers" unless $ENV{PERL_CORE}; + $version = $CLASS->new(5.005_03); + is ( "$version" , "5.5.30" , '5.005_03 eq 5.5.30' ); + $version = $CLASS->new(1.23); + is ( "$version" , "1.230" , '1.23 eq "1.230"' ); + + # Test quoted number processing + diag "tests with quoted numbers" unless $ENV{PERL_CORE}; + $version = $CLASS->new("5.005_03"); + is ( "$version" , "5.5_30" , '"5.005_03" eq "5.5_30"' ); + $version = $CLASS->new("v1.23"); + is ( "$version" , "1.23.0" , '"v1.23" eq "1.23.0"' ); + + # Test stringify operator + diag "tests with stringify" unless $ENV{PERL_CORE}; + $version = $CLASS->new("5.005"); + is ( "$version" , "5.005" , '5.005 eq "5.005"' ); + $version = $CLASS->new("5.006.001"); + is ( "$version" , "5.6.1" , '5.006.001 eq 5.6.1' ); + $version = $CLASS->new("1.2.3_4"); + is ( "$version" , "1.2.3_4" , 'alpha version 1.2.3_4 eq 1.2.3_4' ); + + # test illegal formats + diag "test illegal formats" unless $ENV{PERL_CORE}; + eval {my $version = $CLASS->new("1.2_3_4")}; + like($@, qr/multiple underscores/, + "Invalid version format (multiple underscores)"); + + eval {my $version = $CLASS->new("1.2_3.4")}; + like($@, qr/underscores before decimal/, + "Invalid version format (underscores before decimal)"); + + $version = $CLASS->new("99 and 44/100 pure"); + ok ("$version" eq "99.000", '$version eq "99.000"'); + ok ($version->numify == 99.0, '$version->numify == 99.0'); + + $version = $CLASS->new("something"); + ok (defined $version, 'defined $version'); + + # reset the test object to something reasonable + $version = $CLASS->new("1.2.3"); + + # Test boolean operator + ok ($version, 'boolean'); + + # Test class membership + isa_ok ( $version, "version" ); + + # Test comparison operators with self + diag "tests with self" unless $ENV{PERL_CORE}; + ok ( $version eq $version, '$version eq $version' ); + is ( $version cmp $version, 0, '$version cmp $version == 0' ); + ok ( $version == $version, '$version == $version' ); + + # test first with non-object + $version = $CLASS->new("5.006.001"); + $new_version = "5.8.0"; + diag "tests with non-objects" unless $ENV{PERL_CORE}; + ok ( $version ne $new_version, '$version ne $new_version' ); + ok ( $version lt $new_version, '$version lt $new_version' ); + ok ( $new_version gt $version, '$new_version gt $version' ); + ok ( ref(\$new_version) eq 'SCALAR', 'no auto-upgrade'); + $new_version = "$version"; + ok ( $version eq $new_version, '$version eq $new_version' ); + ok ( $new_version eq $version, '$new_version eq $version' ); + + # now test with existing object + $new_version = $CLASS->new("5.8.0"); + diag "tests with objects" unless $ENV{PERL_CORE}; + ok ( $version ne $new_version, '$version ne $new_version' ); + ok ( $version lt $new_version, '$version lt $new_version' ); + ok ( $new_version gt $version, '$new_version gt $version' ); + $new_version = $CLASS->new("$version"); + ok ( $version eq $new_version, '$version eq $new_version' ); + + # Test Numeric Comparison operators + # test first with non-object + $new_version = "5.8.0"; + diag "numeric tests with non-objects" unless $ENV{PERL_CORE}; + ok ( $version == $version, '$version == $version' ); + ok ( $version < $new_version, '$version < $new_version' ); + ok ( $new_version > $version, '$new_version > $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + + # now test with existing object + $new_version = $CLASS->new($new_version); + diag "numeric tests with objects" unless $ENV{PERL_CORE}; + ok ( $version < $new_version, '$version < $new_version' ); + ok ( $new_version > $version, '$new_version > $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + + # now test with actual numbers + diag "numeric tests with numbers" unless $ENV{PERL_CORE}; + ok ( $version->numify() == 5.006001, '$version->numify() == 5.006001' ); + ok ( $version->numify() <= 5.006001, '$version->numify() <= 5.006001' ); + ok ( $version->numify() < 5.008, '$version->numify() < 5.008' ); + #ok ( $version->numify() > v5.005_02, '$version->numify() > 5.005_02' ); + + # test with long decimals + diag "Tests with extended decimal versions" unless $ENV{PERL_CORE}; + $version = $CLASS->new(1.002003); + ok ( $version eq "1.2.3", '$version eq "1.2.3"'); + ok ( $version->numify == 1.002003, '$version->numify == 1.002003'); + $version = $CLASS->new("2002.09.30.1"); + ok ( $version eq "2002.9.30.1",'$version eq 2002.9.30.1'); + ok ( $version->numify == 2002.009030001, + '$version->numify == 2002.009030001'); + + # now test with alpha version form with string + $version = $CLASS->new("1.2.3"); + $new_version = "1.2.3_4"; + diag "tests with alpha-style non-objects" unless $ENV{PERL_CORE}; + ok ( $version lt $new_version, '$version lt $new_version' ); + ok ( $new_version gt $version, '$new_version gt $version' ); + ok ( $version ne $new_version, '$version ne $new_version' ); + + $version = $CLASS->new("1.2.4"); + diag "numeric tests with alpha-style non-objects" unless $ENV{PERL_CORE}; + ok ( $version > $new_version, '$version > $new_version' ); + ok ( $new_version < $version, '$new_version < $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + + # now test with alpha version form with object + $version = $CLASS->new("1.2.3"); + $new_version = $CLASS->new("1.2.3_4"); + diag "tests with alpha-style objects" unless $ENV{PERL_CORE}; + ok ( $version < $new_version, '$version < $new_version' ); + ok ( $new_version > $version, '$new_version > $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + ok ( !$version->is_alpha, '!$version->is_alpha'); + ok ( $new_version->is_alpha, '$new_version->is_alpha'); + + $version = $CLASS->new("1.2.4"); + diag "tests with alpha-style objects" unless $ENV{PERL_CORE}; + ok ( $version > $new_version, '$version > $new_version' ); + ok ( $new_version < $version, '$new_version < $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + + $version = $CLASS->new("1.2.3.4"); + $new_version = $CLASS->new("1.2.3_4"); + diag "tests with alpha-style objects with same subversion" unless $ENV{PERL_CORE}; + ok ( $version > $new_version, '$version > $new_version' ); + ok ( $new_version < $version, '$new_version < $version' ); + ok ( $version != $new_version, '$version != $new_version' ); + + diag "test implicit [in]equality" unless $ENV{PERL_CORE}; + $version = $CLASS->new("v1.2.3"); + $new_version = $CLASS->new("1.2.3.0"); + ok ( $version == $new_version, '$version == $new_version' ); + $new_version = $CLASS->new("1.2.3_0"); + ok ( $version == $new_version, '$version == $new_version' ); + $new_version = $CLASS->new("1.2.3.1"); + ok ( $version < $new_version, '$version < $new_version' ); + $new_version = $CLASS->new("1.2.3_1"); + ok ( $version < $new_version, '$version < $new_version' ); + $new_version = $CLASS->new("1.1.999"); + ok ( $version > $new_version, '$version > $new_version' ); + + # that which is not expressly permitted is forbidden + diag "forbidden operations" unless $ENV{PERL_CORE}; + ok ( !eval { ++$version }, "noop ++" ); + ok ( !eval { --$version }, "noop --" ); + ok ( !eval { $version/1 }, "noop /" ); + ok ( !eval { $version*3 }, "noop *" ); + ok ( !eval { abs($version) }, "noop abs" ); + + # test the qv() sub + diag "testing qv" unless $ENV{PERL_CORE}; + $version = qv("1.2"); + ok ( $version eq "1.2.0", 'qv("1.2") eq "1.2.0"' ); + $version = qv(1.2); + ok ( $version eq "1.2.0", 'qv(1.2) eq "1.2.0"' ); + + # test creation from existing version object + diag "create new from existing version" unless $ENV{PERL_CORE}; + ok (eval {$new_version = version->new($version)}, + "new from existing object"); + ok ($new_version == $version, "duped object identical"); + + # test the CVS revision mode + diag "testing CVS Revision" unless $ENV{PERL_CORE}; + $version = new version qw$Revision: 1.2$; + ok ( $version eq "1.2.0", 'qw$Revision: 1.2$ eq 1.2.0' ); + + # test reformed UNIVERSAL::VERSION + diag "Replacement UNIVERSAL::VERSION tests" unless $ENV{PERL_CORE}; + + # we know this file is here since we require it ourselves + $version = $Test::More::VERSION; + eval "use Test::More $version"; + unlike($@, qr/Test::More version $version/, + 'Replacement eval works with exact version'); + + $version = $Test::More::VERSION+0.01; # this should fail even with old UNIVERSAL::VERSION + eval "use Test::More $version"; + like($@, qr/Test::More version $version/, + 'Replacement eval works with incremented version'); + + $version =~ s/\.0$//; #convert to string and remove trailing '.0' + chop($version); # shorten by 1 digit, should still succeed + eval "use Test::More $version"; + unlike($@, qr/Test::More version $version/, + 'Replacement eval works with single digit'); + + $version += 0.1; # this would fail with old UNIVERSAL::VERSION + eval "use Test::More $version"; + like($@, qr/Test::More version $version/, + 'Replacement eval works with incremented digit'); + +SKIP: { + skip 'Cannot test v-strings with Perl < 5.8.1', 4 + if $] < 5.008_001; + diag "Tests with v-strings" unless $ENV{PERL_CORE}; + $version = $CLASS->new(1.2.3); + ok("$version" eq "1.2.3", '"$version" eq 1.2.3'); + $version = $CLASS->new(1.0.0); + $new_version = $CLASS->new(1); + ok($version == $new_version, '$version == $new_version'); + ok($version eq $new_version, '$version eq $new_version'); + $version = qv(1.2.3); + ok("$version" eq "1.2.3", 'v-string initialized qv()'); + } +} Added: trunk/orca/packages/version-0.39/typemap ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/typemap Sat Jun 5 23:02:34 2004 @@ -0,0 +1,29 @@ +############################################################################### +## ## +## Typemap for module "Universal::Version" ## +## ## +## Copyright (c) 2001 by John Peacock. ## +## All rights reserved. ## +## ## +## This package is free software; you can redistribute it ## +## and/or modify it under the same terms as Perl itself. ## +## ## +############################################################################### + +TYPEMAP + +N_int T_IV +N_long T_IV +Z_int T_IV +Z_long T_IV +boolean T_IV +version T_PTROBJ_SPECIAL + +INPUT + +T_PTROBJ_SPECIAL + if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")) { + $var = $arg; + } + else + Perl_croak(aTHX_ \"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\") Added: trunk/orca/packages/version-0.39/util.c ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/util.c Sat Jun 5 23:02:34 2004 @@ -0,0 +1,396 @@ +#include "util.h" + +/* +=for apidoc scan_version + +Returns a pointer to the next character after the parsed +version string, as well as upgrading the passed in SV to +an RV. + +Function must be called with an already existing SV like + + sv = newSV(0); + s = scan_version(s,SV *sv, bool qv); + +Performs some preprocessing to the string to ensure that +it has the correct characteristics of a version. Flags the +object if it contains an underscore (which denotes this +is a alpha version). The boolean qv denotes that the version +should be interpreted as if it had multiple decimals, even if +it doesn't. + +=cut +*/ + +char * +Perl_scan_version(pTHX_ char *s, SV *rv, bool qv) +{ + const char *start = s; + char *pos = s; + I32 saw_period = 0; + bool saw_under = 0; + SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ + (void)sv_upgrade(sv, SVt_PVAV); /* needs to be an AV type */ + + /* pre-scan the imput string to check for decimals */ + while ( *pos == '.' || *pos == '_' || isDIGIT(*pos) ) + { + if ( *pos == '.' ) + { + if ( saw_under ) + Perl_croak(aTHX_ "Invalid version format (underscores before decimal)"); + saw_period++ ; + } + else if ( *pos == '_' ) + { + if ( saw_under ) + Perl_croak(aTHX_ "Invalid version format (multiple underscores)"); + saw_under = 1; + } + pos++; + } + pos = s; + + if (*pos == 'v') { + pos++; /* get past 'v' */ + qv = 1; /* force quoted version processing */ + } + while (isDIGIT(*pos)) + pos++; + if (!isALPHA(*pos)) { + I32 rev; + + if (*s == 'v') s++; /* get past 'v' */ + + for (;;) { + rev = 0; + { + /* this is atoi() that delimits on underscores */ + char *end = pos; + I32 mult = 1; + I32 orev; + if ( s < pos && s > start && *(s-1) == '_' ) { + mult *= -1; /* alpha version */ + } + /* the following if() will only be true after the decimal + * point of a version originally created with a bare + * floating point number, i.e. not quoted in any way + */ + if ( !qv && s > start+1 && saw_period == 1 ) { + mult *= 100; + while ( s < end ) { + orev = rev; + rev += (*s - '0') * mult; + mult /= 10; + if ( PERL_ABS(orev) > PERL_ABS(rev) ) + Perl_croak(aTHX_ "Integer overflow in version"); + s++; + } + } + else { + while (--end >= s) { + orev = rev; + rev += (*end - '0') * mult; + mult *= 10; + if ( PERL_ABS(orev) > PERL_ABS(rev) ) + Perl_croak(aTHX_ "Integer overflow in version"); + } + } + } + + /* Append revision */ + av_push((AV *)sv, newSViv(rev)); + if ( (*pos == '.' || *pos == '_') && isDIGIT(pos[1])) + s = ++pos; + else if ( isDIGIT(*pos) ) + s = pos; + else { + s = pos; + break; + } + while ( isDIGIT(*pos) ) { + if ( saw_period == 1 && pos-s == 3 ) + break; + pos++; + } + } + } + if ( qv ) { /* quoted versions always become full version objects */ + I32 len = av_len((AV *)sv); + for ( len = 2 - len; len != 0; len-- ) + av_push((AV *)sv, newSViv(0)); + } + return s; +} + +/* +=for apidoc new_version + +Returns a new version object based on the passed in SV: + + SV *sv = new_version(SV *ver); + +Does not alter the passed in ver SV. See "upg_version" if you +want to upgrade the SV. + +=cut +*/ + +SV * +Perl_new_version(pTHX_ SV *ver) +{ + SV *rv = newSV(0); + if ( sv_derived_from(ver,"version") ) /* can just copy directly */ + { + I32 key; + AV *av = (AV *)SvRV(ver); + SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ + (void)sv_upgrade(sv, SVt_PVAV); /* needs to be an AV type */ + for ( key = 0; key <= av_len(av); key++ ) + { + I32 rev = SvIV(*av_fetch(av, key, FALSE)); + av_push((AV *)sv, newSViv(rev)); + } + return rv; + } +#ifdef SvVOK + if ( SvVOK(ver) ) { /* already a v-string */ + char *version; + MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring); + version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); + sv_setpv(rv,version); + Safefree(version); + } + else { +#endif + sv_setsv(rv,ver); /* make a duplicate */ +#ifdef SvVOK + } +#endif + upg_version(rv); + return rv; +} + +/* +=for apidoc upg_version + +In-place upgrade of the supplied SV to a version object. + + SV *sv = upg_version(SV *sv); + +Returns a pointer to the upgraded SV. + +=cut +*/ + +SV * +Perl_upg_version(pTHX_ SV *ver) +{ + char *version; + bool qv = 0; + + if ( SvNOK(ver) ) /* may get too much accuracy */ + { + char tbuf[64]; + sprintf(tbuf,"%.9"NVgf, SvNVX(ver)); + version = savepv(tbuf); + } +#ifdef SvVOK + else if ( SvVOK(ver) ) { /* already a v-string */ + MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring); + version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); + qv = 1; + } +#endif + else /* must be a string or something like a string */ + { + STRLEN n_a; + version = savepv(SvPV(ver,n_a)); + } + (void)scan_version(version, ver, qv); + Safefree(version); + return ver; +} + + +/* +=for apidoc vnumify + +Accepts a version object and returns the normalized floating +point representation. Call like: + + sv = vnumify(rv); + +NOTE: you can pass either the object directly or the SV +contained within the RV. + +=cut +*/ + +SV * +Perl_vnumify(pTHX_ SV *vs) +{ + I32 i, len, digit; + SV *sv = newSV(0); + if ( SvROK(vs) ) + vs = SvRV(vs); + len = av_len((AV *)vs); + if ( len == -1 ) + { + Perl_sv_catpv(aTHX_ sv,"0"); + return sv; + } + digit = SvIVX(*av_fetch((AV *)vs, 0, 0)); + Perl_sv_setpvf(aTHX_ sv,"%d.", (int)PERL_ABS(digit)); + for ( i = 1 ; i < len ; i++ ) + { + digit = SvIVX(*av_fetch((AV *)vs, i, 0)); + Perl_sv_catpvf(aTHX_ sv,"%03d", (int)PERL_ABS(digit)); + } + if ( len > 0 ) + { + digit = SvIVX(*av_fetch((AV *)vs, len, 0)); + if ( (int)PERL_ABS(digit) != 0 || len == 1 ) + { + /* Don't display additional trailing zeros */ + Perl_sv_catpvf(aTHX_ sv,"%03d", (int)PERL_ABS(digit)); + } + } + else /* len == 0 */ + { + Perl_sv_catpv(aTHX_ sv,"000"); + } + return sv; +} + +/* +=for apidoc vnormal + +Accepts a version object and returns the normalized string +representation. Call like: + + sv = vnormal(rv); + +NOTE: you can pass either the object directly or the SV +contained within the RV. + +=cut +*/ + +SV * +Perl_vnormal(pTHX_ SV *vs) +{ + I32 i, len, digit; + SV *sv = newSV(0); + if ( SvROK(vs) ) + vs = SvRV(vs); + len = av_len((AV *)vs); + if ( len == -1 ) + { + Perl_sv_catpv(aTHX_ sv,""); + return sv; + } + digit = SvIVX(*av_fetch((AV *)vs, 0, 0)); + Perl_sv_setpvf(aTHX_ sv,"%"IVdf,(IV)digit); + for ( i = 1 ; i <= len ; i++ ) + { + digit = SvIVX(*av_fetch((AV *)vs, i, 0)); + if ( digit < 0 ) + Perl_sv_catpvf(aTHX_ sv,"_%"IVdf,(IV)-digit); + else + Perl_sv_catpvf(aTHX_ sv,".%"IVdf,(IV)digit); + } + + if ( len <= 2 ) { /* short version, must be at least three */ + for ( len = 2 - len; len != 0; len-- ) + Perl_sv_catpv(aTHX_ sv,".0"); + } + + return sv; +} + +/* +=for apidoc vstringify + +In order to maintain maximum compatibility with earlier versions +of Perl, this function will return either the floating point +notation or the multiple dotted notation, depending on whether +the original version contained 1 or more dots, respectively + +=cut +*/ + +SV * +Perl_vstringify(pTHX_ SV *vs) +{ + I32 i, len, digit; + if ( SvROK(vs) ) + vs = SvRV(vs); + len = av_len((AV *)vs); + + if ( len < 2 ) + return vnumify(vs); + else + return vnormal(vs); +} + +/* +=for apidoc vcmp + +Version object aware cmp. Both operands must already have been +converted into version objects. + +=cut +*/ + +int +Perl_vcmp(pTHX_ SV *lsv, SV *rsv) +{ + I32 i,l,m,r,retval; + if ( SvROK(lsv) ) + lsv = SvRV(lsv); + if ( SvROK(rsv) ) + rsv = SvRV(rsv); + l = av_len((AV *)lsv); + r = av_len((AV *)rsv); + m = l < r ? l : r; + retval = 0; + i = 0; + while ( i <= m && retval == 0 ) + { + I32 left = SvIV(*av_fetch((AV *)lsv,i,0)); + I32 right = SvIV(*av_fetch((AV *)rsv,i,0)); + bool lalpha = left < 0 ? 1 : 0; + bool ralpha = right < 0 ? 1 : 0; + left = abs(left); + right = abs(right); + if ( left < right || (left == right && lalpha && !ralpha) ) + retval = -1; + if ( left > right || (left == right && ralpha && !lalpha) ) + retval = +1; + i++; + } + + if ( l != r && retval == 0 ) /* possible match except for trailing 0's */ + { + if ( l < r ) + { + while ( i <= r && retval == 0 ) + { + if ( SvIV(*av_fetch((AV *)rsv,i,0)) != 0 ) + retval = -1; /* not a match after all */ + i++; + } + } + else + { + while ( i <= l && retval == 0 ) + { + if ( SvIV(*av_fetch((AV *)lsv,i,0)) != 0 ) + retval = +1; /* not a match after all */ + i++; + } + } + } + return retval; +} Added: trunk/orca/packages/version-0.39/util.h ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/util.h Sat Jun 5 23:02:34 2004 @@ -0,0 +1,28 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include "ppport.h" + +#ifndef PERL_ABS +#define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) +#endif + +#ifndef SVf +#define SVf "_" +#endif + +char * Perl_scan_version(pTHX_ char *s, SV *rv, bool qv); +SV * Perl_new_version(pTHX_ SV *ver); +SV * Perl_upg_version(pTHX_ SV *sv); +SV * Perl_vnumify(pTHX_ SV *vs); +SV * Perl_vnormal(pTHX_ SV *vs); +SV * Perl_vstringify(pTHX_ SV *vs); +int Perl_vcmp(pTHX_ SV *lsv, SV *rsv); + +#define vnumify(a) Perl_vnumify(aTHX_ a) +#define vnormal(a) Perl_vnormal(aTHX_ a) +#define vstringify(a) Perl_vstringify(aTHX_ a) +#define vcmp(a,b) Perl_vcmp(aTHX_ a,b) +#define scan_version(a,b,c) Perl_scan_version(aTHX_ a,b,c) +#define new_version(a) Perl_new_version(aTHX_ a) +#define upg_version(a) Perl_upg_version(aTHX_ a) Added: trunk/orca/packages/version-0.39/version.xs ============================================================================== --- (empty file) +++ trunk/orca/packages/version-0.39/version.xs Sat Jun 5 23:02:34 2004 @@ -0,0 +1,237 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include "util.h" + +/* -------------------------------------------------- + * $Revision: 2.5 $ + * --------------------------------------------------*/ + +typedef SV *version; + +MODULE = version PACKAGE = version + +PROTOTYPES: DISABLE +VERSIONCHECK: DISABLE + +BOOT: + /* register the overloading (type 'A') magic */ + PL_amagic_generation++; + newXS("version::()", XS_version_noop, file); + newXS("version::(\"\"", XS_version_stringify, file); + newXS("version::(0+", XS_version_numify, file); + newXS("version::(cmp", XS_version_vcmp, file); + newXS("version::(<=>", XS_version_vcmp, file); + newXS("version::(bool", XS_version_boolean, file); + newXS("version::(nomethod", XS_version_noop, file); + newXS("UNIVERSAL::VERSION", XS_version_VERSION, file); + +version +new(class,...) + char *class +PPCODE: +{ + SV *vs = ST(1); + SV *rv; + if (items == 3 ) + { + STRLEN n_a; + vs = sv_newmortal(); + sv_setpvf(vs,"v%s",SvPV(ST(2),n_a)); + } + + rv = new_version(vs); + if ( strcmp(class,"version") != 0 ) /* inherited new() */ + sv_bless(rv, gv_stashpv(class,TRUE)); + + PUSHs(sv_2mortal(rv)); +} + +void +stringify (lobj,...) + version lobj +PPCODE: +{ + PUSHs(sv_2mortal(vstringify(lobj))); +} + +void +numify (lobj,...) + version lobj +PPCODE: +{ + PUSHs(sv_2mortal(vnumify(lobj))); +} + +void +vcmp (lobj,...) + version lobj +PPCODE: +{ + SV *rs; + SV *rvs; + SV * robj = ST(1); + IV swap = (IV)SvIV(ST(2)); + + if ( ! sv_derived_from(robj, "version") ) + { + robj = sv_2mortal(new_version(robj)); + } + + if ( swap ) + { + rs = newSViv(vcmp(robj,lobj)); + } + else + { + rs = newSViv(vcmp(lobj,robj)); + } + + PUSHs(sv_2mortal(rs)); +} + +void +boolean(lobj,...) + version lobj +PPCODE: +{ + SV *rs; + rs = newSViv( vcmp(lobj,new_version(newSVpvn("0",1))) ); + PUSHs(sv_2mortal(rs)); +} + +void +noop(lobj,...) + version lobj +CODE: +{ + Perl_croak(aTHX_ "operation not supported with version object"); +} + +void +is_alpha(lobj) + version lobj +PPCODE: +{ + AV * av = (AV *)SvRV(lobj); + I32 len = av_len(av); + I32 digit = SvIVX(*av_fetch(av, len, 0)); + if ( digit < 0 ) + XSRETURN_YES; + else + XSRETURN_NO; +} + +void +qv(ver) + SV *ver +PPCODE: +{ +#ifdef SvVOK + if ( !SvVOK(ver) ) { /* not already a v-string */ +#endif + SV *vs = sv_newmortal(); + char *version; + if ( SvNOK(ver) ) /* may get too much accuracy */ + { + char tbuf[64]; + sprintf(tbuf,"%.9"NVgf, SvNVX(ver)); + version = savepv(tbuf); + } + else + { + STRLEN n_a; + version = savepv(SvPV(ver,n_a)); + } + (void)scan_version(version,vs,TRUE); + Safefree(version); + + PUSHs(vs); +#ifdef SvVOK + } + else + { + PUSHs(sv_2mortal(new_version(ver))); + } +#endif +} + +void +normal(ver) + SV *ver +PPCODE: +{ + PUSHs(sv_2mortal(vnormal(ver))); +} + +void +VERSION(sv,...) + SV *sv +PPCODE: +{ + HV *pkg; + GV **gvp; + GV *gv; + char *undef; + + if (SvROK(sv)) { + sv = (SV*)SvRV(sv); + if (!SvOBJECT(sv)) + Perl_croak(aTHX_ "Cannot find version of an unblessed reference"); + pkg = SvSTASH(sv); + } + else { + pkg = gv_stashsv(sv, FALSE); + } + + gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**); + + if (gvp && isGV(gv = *gvp) && SvOK(sv = GvSV(gv))) { + SV *nsv = sv_newmortal(); + sv_setsv(nsv, sv); + sv = nsv; + if ( !sv_derived_from(sv, "version")) + upg_version(sv); + undef = Nullch; + } + else { + sv = (SV*)&PL_sv_undef; + undef = "(undef)"; + } + + if (items > 1) { + SV *req = ST(1); + STRLEN len; + + if (undef) { + if (pkg) + Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed", + HvNAME(pkg), HvNAME(pkg)); + else { + char *str = SvPVx(ST(0), len); + + Perl_croak(aTHX_ "%s defines neither package nor VERSION--version check failed", str); + } + } + + if ( !sv_derived_from(req, "version")) { + /* req may very well be R/O, so create a new object */ + SV *nsv = sv_newmortal(); + sv_setsv(nsv, req); + req = nsv; + upg_version(req); + } + + if ( vcmp( req, sv ) > 0 ) + Perl_croak(aTHX_ "%s version %"SVf" (%"SVf") required--" + "this is only version %"SVf" (%"SVf")", HvNAME(pkg), + vnumify(req),vnormal(req),vnumify(sv),vnormal(sv)); + } + + if ( sv_derived_from(sv, "version") ) + PUSHs(vnumify(sv)); + else + PUSHs(sv); + + XSRETURN(1); +} From blair at orcaware.com Sat Jun 5 23:16:29 2004 From: blair at orcaware.com (Blair Zajac) Date: Sat, 5 Jun 2004 23:16:29 -0700 Subject: [Orca-checkins] r335 - trunk/orca Message-ID: <200406060616.i566GTl1014748@orcaware.com> Author: blair Date: Sat Jun 5 23:12:42 2004 New Revision: 335 Modified: trunk/orca/INSTALL Log: * INSTALL (Determine which Perl modules need compiling and installing): When instructing how to install Perl modules, add 'UNINST=1' to the 'make install' command to have the install remove files associated with older versions of the Perl module being installed. Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL Sat Jun 5 23:12:42 2004 @@ -202,7 +202,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 Date::Parse @@ -213,7 +213,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 Devel::DProf @@ -224,7 +224,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 Digest::MD5 @@ -235,7 +235,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 Math::IntervalSearch @@ -246,7 +246,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 RRDs @@ -261,7 +261,7 @@ % make % cd perl-shared % make test - % make install + % make install UNINST=1 For large installations, I recommend that RRDs be compiled with optimization turned on. @@ -275,7 +275,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 Time::HiRes @@ -286,7 +286,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 version @@ -297,7 +297,7 @@ % perl Makefile.PL % make % make test - % make install + % make install UNINST=1 5) Make Orca and any necessary Perl modules. From blair at orcaware.com Mon Jun 7 22:01:07 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 7 Jun 2004 22:01:07 -0700 Subject: [Orca-checkins] r337 - in trunk/orca: lib/Orca orca Message-ID: <200406080501.i58517MD010219@orcaware.com> Author: blair Date: Mon Jun 7 21:59:04 2004 New Revision: 337 Modified: trunk/orca/lib/Orca/Config.pm trunk/orca/lib/Orca/Constants.pm trunk/orca/orca/orca.pl.in Log: Implement a new versioning scheme for Orca to fix a couple of issues. 1) The old code would have version 0.9 be greater than version 0.28. 2) The version string can optionally contain the Subversion repository revision number to allow non-blessed distributions to have a revision number. This will make it much easier to track Orca versions that people have installed. 3) Be much more flexible in handing required version numbers. * lib/Orca/Constants.pm: ($ORCA_VER_MAJOR), ($ORCA_VER_MINOR), ($ORCA_VER_PATCH), ($ORCA_VER_QUOTED), ($ORCA_VER_REVISION), ($ORCA_VER_TAG): New exported version variables. * lib/Orca/Config.pm (main): Use the 'version' Perl module. Use $ORCA_VER_QUOTED instead of $ORCA_VERSION. (check_config): Fix a bug where 0.28 is a release number greater than 0.9. Be much more flexible in handling different required Orca version number strings. * orca/orca.pl.in (main): Use the 'version' Perl module and specify its the required version of the version module. (pod): Give example version number strings. Modified: trunk/orca/lib/Orca/Config.pm ============================================================================== --- trunk/orca/lib/Orca/Config.pm (original) +++ trunk/orca/lib/Orca/Config.pm Mon Jun 7 21:59:04 2004 @@ -13,10 +13,12 @@ use strict; use Carp; use Exporter; +use version; + use Orca::Constants qw($opt_verbose $is_sub_re die_when_called - $ORCA_VERSION + $ORCA_VER_QUOTED @CONST_IMAGE_PLOT_TYPES %CONST_IMAGE_PLOT_INFO @IMAGE_PLOT_TYPES @@ -326,21 +328,42 @@ my @require = @{$config_global{require}}; if (@require == 2) { my ($require_what, $require_version) = @require; - unless ($require_what eq 'Orca') { + if ($require_what eq 'Orca') { + # Normalize the required version string to the form + # \d+\.\d+\.\d+ . To handle almost any input version string, + # split on the existing periods and for each substring, if it + # is not defined or has 0 length, then set it to 0. Do not + # worry about there being more than two periods in the given + # string, the regular expression match below will catch + # invalid version strings. + my @vers = split(/\./, $require_version); + + for (my $i=0; $i<3; ++$i) { + unless (defined $vers[$i] and length $vers[$i]) { + $vers[$i] = 0; + } + } + my $reformulated_required_version = join('.', @vers); + + if ($reformulated_required_version =~ /^\d+\.\d+\.\d+$/) { + $require_version = version->new($reformulated_required_version); + my $orca_version = version->new($ORCA_VER_QUOTED); + + if ($orca_version < $require_version) { + warn "$0: Orca version $ORCA_VER_QUOTED less than required ", + "version $require_version specified in '$config_filename'.\n"; + ++$number_errors; + } + } else { + warn "$0: error: 'require' second argument '$require_version' is ", + "not a valid version number in '$config_filename'.\n"; + ++$number_errors; + } + } else { warn "$0: error: 'require' only accepts 'Orca' as first argument in ", "'$config_filename'.\n"; ++$number_errors; } - if ($require_version !~ /^\d+(?:\.\d*)?$/ and - $require_version !~ /^\.\d+$/) { - warn "$0: error: 'require' second argument '$require_version' is not ", - "a number in '$config_filename'.\n"; - ++$number_errors; - } elsif ($ORCA_VERSION < $require_version) { - warn "$0: Orca version $ORCA_VERSION less than required version ", - "$require_version specified in '$config_filename'.\n"; - ++$number_errors; - } } else { warn "$0: error: 'require' needs two arguments in '$config_filename'.\n"; ++$number_errors; Modified: trunk/orca/lib/Orca/Constants.pm ============================================================================== --- trunk/orca/lib/Orca/Constants.pm (original) +++ trunk/orca/lib/Orca/Constants.pm Mon Jun 7 21:59:04 2004 @@ -16,7 +16,32 @@ @ISA = qw(Exporter); $VERSION = substr q$Revision: 0.01 $, 10; -# ORCA_VERSION This version of Orca. +# ORCA_VER_MAJOR Orca's major version number. Increment when +# incompatible changes are made to published +# interfaces. +# ORCA_VER_MINOR Orca's minor version number. Increment when +# new functionality is added or new interfaces +# are defined, but all changes are backward +# compatible. +# ORCA_VER_PATCH Orca's patch version number. Increment for +# every released patch. +# ORCA_VER_QUOTED The variables $ORCA_VER_MAJOR, +# $ORCA_VER_MINOR and $ORCA_VER_PATCH +# joined with periods, i.e. "1.2.3". +# ORCA_VER_REVISION The Subversion repository revision number of +# this release. It remains 0 in the repository. +# When rolling a tarball, it is automatically +# replaced with a best guess to be the correct +# revision number. +# ORCA_VER_TAG A string describing the version. This tag +# remains " (dev $ORCA_VER_REVISION)" in the +# repository so that we can always see that the +# software has been built from the repository +# rather than a "blessed" version. For snapshot +# releases, the variable is left unchanged. For +# final releases, it is emptied. +# ORCA_VERSION The real version of Orca. Formed by the string +# "$ORCA_VER_QUOTED$ORCA_VER_TAG". # ORCA_RRD_VERSION This is the version number used in creating the DS # names in RRDs. This should be updated any time a # new version of Orca needs some new content in its @@ -24,12 +49,34 @@ # string Orca with this string of digits. # DAY_SECONDS The number of seconds in one day. # IS_WIN32 If Orca is running on a Windows platform. -use vars qw($ORCA_VERSION $ORCA_RRD_VERSION); -push(@EXPORT_OK, qw($ORCA_VERSION $ORCA_RRD_VERSION DAY_SECONDS IS_WIN32)); -$ORCA_VERSION = '0.27'; -$ORCA_RRD_VERSION = 19990222; -sub DAY_SECONDS () { 24*60*60 }; -sub IS_WIN32 () { $^O eq 'MSWin32' }; +use vars qw($ORCA_VER_MAJOR + $ORCA_VER_MINOR + $ORCA_VER_PATCH + $ORCA_VER_QUOTED + $ORCA_VER_REVISION + $ORCA_VER_TAG + $ORCA_VERSION + $ORCA_RRD_VERSION); +push(@EXPORT_OK, qw($ORCA_VER_MAJOR + $ORCA_VER_MINOR + $ORCA_VER_PATCH + $ORCA_VER_QUOTED + $ORCA_VER_REVISION + $ORCA_VER_TAG + $ORCA_VERSION + $ORCA_RRD_VERSION + DAY_SECONDS + IS_WIN32)); +$ORCA_VER_MAJOR = 0; +$ORCA_VER_MINOR = 28; +$ORCA_VER_PATCH = 0; +$ORCA_VER_REVISION = 0; +$ORCA_VER_QUOTED = "$ORCA_VER_MAJOR.$ORCA_VER_MINOR.$ORCA_VER_PATCH"; +$ORCA_VER_TAG = " (dev $ORCA_VER_REVISION)"; +$ORCA_VERSION = "$ORCA_VER_QUOTED$ORCA_VER_TAG"; +$ORCA_RRD_VERSION = 19990222; +sub DAY_SECONDS () { 24*60*60 }; +sub IS_WIN32 () { $^O eq 'MSWin32' }; # These define the name of the different round robin archives (RRAs) # to create in each RRD file, how many primary data points go into a Modified: trunk/orca/orca/orca.pl.in ============================================================================== --- trunk/orca/orca/orca.pl.in (original) +++ trunk/orca/orca/orca.pl.in Mon Jun 7 21:59:04 2004 @@ -34,6 +34,7 @@ use Math::IntervalSearch @MATH_INTERVALSEARCH_VER@ qw(interval_search); use Storable @STORABLE_VER@; use RRDs @RRDTOOL_VER@; +use version @VERSION_VER@; # Set behavior of the Data::Dumper module. $Data::Dumper::Indent = 1; @@ -1455,7 +1456,8 @@ The B parameter allows the configuration file to specify the minimum required version of a package to run. Both I and I are required and I must be a -number, not a general Perl expression. +version number, not a general Perl expression. Valid styles of +version numbers include: '1', '1.', '.28', '0.28.3'. Currently, only the minimum required version of Orca can be specified and I must be set to Orca. From blair at orcaware.com Mon Jun 7 22:32:46 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 7 Jun 2004 22:32:46 -0700 Subject: [Orca-checkins] r338 - in trunk/orca/data_gatherers: aix hp orcallator procallator Message-ID: <200406080532.i585WkRI014516@orcaware.com> Author: blair Date: Mon Jun 7 22:30:50 2004 New Revision: 338 Modified: trunk/orca/data_gatherers/aix/orcallatorAIX.cfg trunk/orca/data_gatherers/aix/orcallatorTSM.cfg trunk/orca/data_gatherers/hp/hporcallator.cfg trunk/orca/data_gatherers/orcallator/orcallator.cfg.in trunk/orca/data_gatherers/procallator/procallator.cfg.in Log: With the new Orca versioning scheme, a required Orca version of 0.265 is greater than the current 0.28.0, so bump the required version number to 0.28.0. Do not require Orca 0.27, as this version does not support the new versioning scheme, and after all, we want people to use a newer versions of Orca. Finally, I don't want to support older versions. * data_gatherers/aix/orcallatorAIX.cfg, * data_gatherers/aix/orcallatorTSM.cfg, * data_gatherers/hp/hporcallator.cfg, * data_gatherers/orcallator/orcallator.cfg.in, * data_gatherers/procallator/procallator.cfg.in: Require Orca version 0.28.0. Modified: trunk/orca/data_gatherers/aix/orcallatorAIX.cfg ============================================================================== --- trunk/orca/data_gatherers/aix/orcallatorAIX.cfg (original) +++ trunk/orca/data_gatherers/aix/orcallatorAIX.cfg Mon Jun 7 22:30:50 2004 @@ -6,7 +6,7 @@ # $LastChangedRevision$ # Require at least this version of Orca. -require Orca 0.265 +require Orca 0.28.0 # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular Modified: trunk/orca/data_gatherers/aix/orcallatorTSM.cfg ============================================================================== --- trunk/orca/data_gatherers/aix/orcallatorTSM.cfg (original) +++ trunk/orca/data_gatherers/aix/orcallatorTSM.cfg Mon Jun 7 22:30:50 2004 @@ -6,7 +6,7 @@ # $LastChangedRevision$ # Require at least this version of Orca. -require Orca 0.265 +require Orca 0.28.0 # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular Modified: trunk/orca/data_gatherers/hp/hporcallator.cfg ============================================================================== --- trunk/orca/data_gatherers/hp/hporcallator.cfg (original) +++ trunk/orca/data_gatherers/hp/hporcallator.cfg Mon Jun 7 22:30:50 2004 @@ -6,7 +6,7 @@ # $LastChangedRevision$ # Require at least this version of Orca. -require Orca 0.265 +require Orca 0.28.0 # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.cfg.in (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.cfg.in Mon Jun 7 22:30:50 2004 @@ -6,7 +6,7 @@ # $LastChangedBy$ # Require at least this version of Orca. -require Orca 0.265 +require Orca 0.28.0 # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular Modified: trunk/orca/data_gatherers/procallator/procallator.cfg.in ============================================================================== --- trunk/orca/data_gatherers/procallator/procallator.cfg.in (original) +++ trunk/orca/data_gatherers/procallator/procallator.cfg.in Mon Jun 7 22:30:50 2004 @@ -6,7 +6,7 @@ # $LastChangedBy$ # Require at least this version of Orca. -require Orca 0.265 +require Orca 0.28.0 # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular From blair at orcaware.com Mon Jun 7 23:09:56 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 7 Jun 2004 23:09:56 -0700 Subject: [Orca-checkins] r339 - trunk/orca/lib Message-ID: <200406080609.i5869u4O018424@orcaware.com> Author: blair Date: Mon Jun 7 23:08:10 2004 New Revision: 339 Modified: trunk/orca/lib/Makefile.in Log: * lib/Makefile.in (install): When installing $(libdir)/Orca/Constants.pm, if svnversion can generate a good "version number" for the entire Orca directory tree, then set $ORCA_VER_REVISION to that value in the installed Constants.pm, not the source tree. Modified: trunk/orca/lib/Makefile.in ============================================================================== --- trunk/orca/lib/Makefile.in (original) +++ trunk/orca/lib/Makefile.in Mon Jun 7 23:08:10 2004 @@ -50,6 +50,17 @@ $(INSTALL) -m 0644 $$f $(libdir)/$$d; \ done \ done + @current_rev="`cd ..; svnversion . 2>/dev/null`"; \ + if test "$$current_rev" != "" && \ + test "$$current_rev" != "exported"; then \ + echo "Found good svnversion for `cd ..; pwd`: $$current_rev"; \ + echo /opt/i386-linux/perl/bin/perl -w -p -i \ + -e 's/^(\$$ORCA_VER_REVISION\s*=\s*).*/$${1}"'$$current_rev'";/' \ + $(libdir)/Orca/Constants.pm; \ + /opt/i386-linux/perl/bin/perl -w -p -i \ + -e 's/^(\$$ORCA_VER_REVISION\s*=\s*).*/$${1}"'$$current_rev'";/' \ + $(libdir)/Orca/Constants.pm; \ + fi clean: From blair at orcaware.com Tue Jun 8 21:17:13 2004 From: blair at orcaware.com (Blair Zajac) Date: Tue, 8 Jun 2004 21:17:13 -0700 Subject: [Orca-checkins] r340 - trunk/orca/lib/Orca Message-ID: <200406090417.i594HDZQ013630@orcaware.com> Author: blair Date: Tue Jun 8 21:15:21 2004 New Revision: 340 Modified: trunk/orca/lib/Orca/HTMLFile.pm Log: * lib/Orca/HTMLFile.pm (DESTROY): Update the Rothschild Image acknowledgment HTML markup at the bottom of every HTML page. Modified: trunk/orca/lib/Orca/HTMLFile.pm ============================================================================== --- trunk/orca/lib/Orca/HTMLFile.pm (original) +++ trunk/orca/lib/Orca/HTMLFile.pm Tue Jun 8 21:15:21 2004 @@ -165,8 +165,9 @@ Funding for Orca provided by renowned fashion - image consultant, - Ashley Rothschild. + image consultant + and extreme + makeover guru, Ashley Rothschild.    From blair at orcaware.com Tue Jun 8 21:50:58 2004 From: blair at orcaware.com (Blair Zajac) Date: Tue, 8 Jun 2004 21:50:58 -0700 Subject: [Orca-checkins] r341 - trunk/orca/lib/Orca Message-ID: <200406090450.i594owbY018425@orcaware.com> Author: blair Date: Tue Jun 8 21:48:55 2004 New Revision: 341 Modified: trunk/orca/lib/Orca/HTMLFile.pm Log: * lib/Orca/HTMLFile.pm (DESTROY): Try to reduce the amount of spam I get by encoding my email address with character entities. Modified: trunk/orca/lib/Orca/HTMLFile.pm ============================================================================== --- trunk/orca/lib/Orca/HTMLFile.pm (original) +++ trunk/orca/lib/Orca/HTMLFile.pm Tue Jun 8 21:48:55 2004 @@ -132,7 +132,10 @@ Orca $ORCA_VERSION by
Blair Zajac
- blair\@orcaware.com + + + blair@orcaware.com Orca home page From blair at orcaware.com Thu Jun 10 21:44:36 2004 From: blair at orcaware.com (Blair Zajac) Date: Thu, 10 Jun 2004 21:44:36 -0700 Subject: [Orca-checkins] r343 - trunk/orca Message-ID: <200406110444.i5B4ial5021690@orcaware.com> Author: blair Date: Thu Jun 10 21:42:25 2004 New Revision: 343 Modified: trunk/orca/CHANGES trunk/orca/NEWS Log: * CHANGES, * NEWS: Fix some stutters. Modified: trunk/orca/CHANGES ============================================================================== --- trunk/orca/CHANGES (original) +++ trunk/orca/CHANGES Thu Jun 10 21:42:25 2004 @@ -179,7 +179,7 @@ match each regular expression in a global integer array, count_procs_results. * orcallator/start_orcallator.sh.in: - Set WEB_SERVER to httpd and and set WEB_SERVER_SECURE to + Set WEB_SERVER to httpd and and WEB_SERVER_SECURE to httpsd and export them both into the environment for orcallator.se to use. Add documentation for these two variables. @@ -188,7 +188,7 @@ * Makefile.in: Restructure the 'all' and 'install' rules so that if make fails in one subdirectory, then the top level - make fail fail immediately. Previously, all subdirectories + 'make fail' fails immediately. Previously, all subdirectories would be built, regardless if there was a failure in any one subdirectory. Do not do this for 'clean' and 'distclean', because they should always clean up as much as they can, Modified: trunk/orca/NEWS ============================================================================== --- trunk/orca/NEWS (original) +++ trunk/orca/NEWS Thu Jun 10 21:42:25 2004 @@ -95,9 +95,9 @@ stat()ed but then fopen() failed. Problem noted by Jeremy McCarty . -10) In orcallator.se, in check_output_log_filename(), stat() was was - being passed a stat_t by value, instead of a pointer to a stat_t. - Only the return value from stat() was being used, so this bug had +10) In orcallator.se, in check_output_log_filename(), stat() was being + passed a stat_t by value, instead of a pointer to a stat_t. Only + the return value from stat() was being used, so this bug had no effect upon the logic of the code. Problem noted by Richard Pettit . From blair at orcaware.com Sat Jun 12 14:09:40 2004 From: blair at orcaware.com (Blair Zajac) Date: Sat, 12 Jun 2004 14:09:40 -0700 Subject: [Orca-checkins] r344 - trunk/orca/lib/Orca Message-ID: <200406122109.i5CL9ekK001364@orcaware.com> Author: blair Date: Sat Jun 12 14:07:53 2004 New Revision: 344 Modified: trunk/orca/lib/Orca/Config.pm trunk/orca/lib/Orca/SourceFile.pm Log: * lib/Orca/Config.pm, * lib/Orca/SourceFile.pm: Rename Orca::Config::get_color to Orca::Config::data_index_to_color. Modified: trunk/orca/lib/Orca/Config.pm ============================================================================== --- trunk/orca/lib/Orca/Config.pm (original) +++ trunk/orca/lib/Orca/Config.pm Sat Jun 12 14:07:53 2004 @@ -34,7 +34,7 @@ # Export the main subroutine to load configuration data and a subroutine # to get a color indexed by an integer. -push(@EXPORT_OK, qw(load_config get_color)); +push(@EXPORT_OK, qw(data_index_to_color load_config)); # The following array and hashes hold the contents of the # configuration file. @@ -228,7 +228,7 @@ 'c7eaff', # Ice blue 'd3ff52'); # Gatorade green -sub get_color { +sub data_index_to_color { $cc_default_colors[$_[0] % @cc_default_colors]; } @@ -825,7 +825,7 @@ # Set the colors of any data not defined. $plot->{color} = [] unless defined $plot->{color}; for (my $k=@{$plot->{color}}; $k<$number_datas; ++$k) { - $plot->{color}[$k] = get_color($k); + $plot->{color}[$k] = data_index_to_color($k); } # Check each line type setting. Use the last line_type to set any Modified: trunk/orca/lib/Orca/SourceFile.pm ============================================================================== --- trunk/orca/lib/Orca/SourceFile.pm (original) +++ trunk/orca/lib/Orca/SourceFile.pm Sat Jun 12 14:07:53 2004 @@ -21,7 +21,7 @@ @config_groups @config_groups_names @config_plots - get_color); + data_index_to_color); use Orca::OldState qw($orca_old_state); use Orca::DataFile qw(ORCA_DATAFILE_LAST_INDEX); use Orca::OpenFileHash qw($open_file_cache); @@ -436,7 +436,8 @@ $plot->{data_type}[$new_data_index-1]; } unless (defined $plot->{color}[$new_data_index]) { - $plot->{color}[$new_data_index] = get_color($new_data_index); + $plot->{color}[$new_data_index] = + data_index_to_color($new_data_index); } unless (defined $plot->{legend}[$new_data_index]) { $plot->{legend}[$new_data_index] = $original_legend; From blair at orcaware.com Sat Jun 12 16:15:08 2004 From: blair at orcaware.com (Blair Zajac) Date: Sat, 12 Jun 2004 16:15:08 -0700 Subject: [Orca-checkins] r345 - trunk/orca/lib/Orca Message-ID: <200406122315.i5CNF8Cs011267@orcaware.com> Author: blair Date: Sat Jun 12 16:13:01 2004 New Revision: 345 Modified: trunk/orca/lib/Orca/SourceFile.pm Log: Variable renaming and reformat to 80 characters. * lib/Orca/SourceFile.pm (add_plots): Rename @name_with_subgroup to @names_with_subgroup. Rename @name_without_subgroup to @names_without_subgroup. Modified: trunk/orca/lib/Orca/SourceFile.pm ============================================================================== --- trunk/orca/lib/Orca/SourceFile.pm (original) +++ trunk/orca/lib/Orca/SourceFile.pm Sat Jun 12 16:13:01 2004 @@ -635,11 +635,14 @@ $eval_result = 0; $@ =~ s/\s+$//g; my $m = $old_i + 1; - $message = "$0: warning: cannot compile '$sub_expr' for plot #$m 'data @{$plot->{data}[$j]}': $@\n"; + $message = "$0: warning: cannot compile '$sub_expr' for " . + "plot #$m 'data @{$plot->{data}[$j]}': $@\n"; } elsif (!defined $test_value) { $eval_result = 0; my $m = $old_i + 1; - $message = "$0: warning: testing of '$sub_expr' for plot #$m 'data @{$plot->{data}[$j]}' yielded an undefined value.\n"; + $message = "$0: warning: testing of '$sub_expr' for " . + "plot #$m 'data @{$plot->{data}[$j]}' yielded " . + "an undefined value.\n"; } if ($message and ($required or $opt_verbose > 1)) { warn $message; @@ -671,8 +674,8 @@ # and a name for this plot that does not include the subgroup name. my @my_rrds; my @my_short_rrds; - my @name_with_subgroup; - my @name_without_subgroup; + my @names_with_subgroup; + my @names_without_subgroup; my $previous_data_type = ''; my $previous_group_index = -1; my $previous_subgroup_name = ''; @@ -684,9 +687,17 @@ my $original_data_expression = join('_', @{$plot->{data}[$j]}); my $substituted_data_expression = $substituted_data_expressions[$j]; - my $name_with_subgroup = "${group_name}_${subgroup_name}_${data_type}_${original_data_expression}"; - push(@name_with_subgroup, $name_with_subgroup); - push(@name_without_subgroup, "${group_name}_${data_type}_${original_data_expression}"); + my $name_with_subgroup = join('_', + $group_name, + $subgroup_name, + $data_type, + $original_data_expression); + my $name_without_subgroup = join('_', + $group_name, + $data_type, + $original_data_expression); + push(@names_with_subgroup, $name_with_subgroup); + push(@names_without_subgroup, $name_without_subgroup); # If the current data expression is very similar to the previous # one, then do not include the group, subgroup and data_type. @@ -715,7 +726,8 @@ # valid get data subroutine is created. Keep the # choose_data_sub for this file. if (defined $substituted_data_expression) { - $choose_data_expr .= " '$name_with_subgroup', $substituted_data_expression,\n"; + $choose_data_expr .= " '$name_with_subgroup', " . + "$substituted_data_expression,\n"; unless (defined $rrd_data_files_ref->{$name_with_subgroup}) { my $rrd_file = Orca::RRDFile->new($group_index, $subgroup_name, @@ -733,14 +745,14 @@ # Generate a new plot for these data. my $image; - my $all_names_with_subgroup = join(',', @name_with_subgroup); + my $all_names_with_subgroup = join(',', @names_with_subgroup); if (defined ($image = $image_files_ref->{hash}{$all_names_with_subgroup})){ $image->add_rrds(@my_rrds); } else { $image = Orca::ImageFile->new($group_index, $subgroup_name, join(',', @my_short_rrds), - join(',', @name_without_subgroup), + join(',', @names_without_subgroup), $plot, $rrd_data_files_ref, \@my_rrds); @@ -763,7 +775,8 @@ } if ($@) { my $m = $old_i + 1; - die "$0: warning: bad evaluation of command for plot #$m:\n$choose_data_expr\nOutput: $@\n"; + die "$0: warning: bad evaluation of command for plot #$m:\n", + "$choose_data_expr\nOutput: $@\n"; } $all_rrds_cache{$cache_key} = $self->[I_ALL_RRD_REF]; @@ -903,7 +916,8 @@ if (defined $value) { if ($self->[I_ALL_RRD_REF]{$rrd_key}->queue_data($time, $value)) { if ($opt_verbose > 2 and !$add) { - print " Loaded '@line' at ", scalar localtime($time), " ($time).\n"; + print " Loaded '@line' at ", scalar localtime($time), + " ($time).\n"; } $add = 1; } From blair at orcaware.com Sun Jun 13 15:47:12 2004 From: blair at orcaware.com (Blair Zajac) Date: Sun, 13 Jun 2004 15:47:12 -0700 Subject: [Orca-checkins] r346 - trunk/orca/lib/Orca Message-ID: <200406132247.i5DMlCa7024597@orcaware.com> Author: blair Date: Sun Jun 13 15:45:12 2004 New Revision: 346 Modified: trunk/orca/lib/Orca/ImageFile.pm trunk/orca/lib/Orca/SourceFile.pm Log: Finally fix the long outstanding bug that generates multiple plots (one plot for each unique combination of input data columns) for one plot appearing in the configuration file. This most commonly appears in the disk space used plots. Patch based off of work from John Garner . * lib/Orca/ImageFile.pm (add_additional_plot): Merge in any new data sources in a plot into an existing image. * lib/Orca/SourceFile.pm (add_plots): For plots that have only one data line and a regular expression match in it, do not generate a name for it that contains a list of all the column names that matched, as this generates a separate image for each combination of matching column names. Instead use a name that is generated by the data line in the configuration file, so it catches all column names that match. If an existing image is found for the case of a single data line with a regular expression match and an existing image is found, then update the original image with the new matching column. Modified: trunk/orca/lib/Orca/ImageFile.pm ============================================================================== --- trunk/orca/lib/Orca/ImageFile.pm (original) +++ trunk/orca/lib/Orca/ImageFile.pm Sun Jun 13 15:45:12 2004 @@ -23,7 +23,8 @@ $INCORRECT_NUMBER_OF_ARGS); use Orca::Config qw(%config_global @config_groups - @config_plots); + @config_plots + data_index_to_color); use Orca::Utils qw(name_to_fsname recursive_mkdir); use vars qw($VERSION); @@ -215,6 +216,60 @@ $self; } +# Merge in any new data sources in a plot into an existing image. +sub add_additional_plot { + unless (@_ == 2) { + confess "$0: Orca::ImageFile::add_additional_plot ", + $INCORRECT_NUMBER_OF_ARGS; + } + + my ($self, $new_plot_ref) = @_; + + my %existing_legends; + my $existing_plot_ref = $self->[I_PLOT_REF]; + + foreach my $legend (@{$existing_plot_ref->{legend}}) { + $existing_legends{$legend} = 1; + } + + my $i = @{$existing_plot_ref->{legend}}; + my $number_legends_in_new_plot = @{$new_plot_ref->{legend}}; + my $number_plots_added = 0; + for (my $j=0; $j<$number_legends_in_new_plot; ++$j) { + next if $existing_legends{$new_plot_ref->{legend}[$j]}; + ++$number_plots_added; + + # For those attributes of the new plot that are array references + # and need to be indexed for the particular data being plotted, + # copy them over. Skip the 'creates' attribute which is not used + # for plotting and skip the color attribute as the color is + # treated + # specially. + for my $attribute (keys %$new_plot_ref) { + next if $attribute eq 'color'; + next if $attribute eq 'creates'; + next unless UNIVERSAL::isa($new_plot_ref->{$attribute}, 'ARRAY'); + $existing_plot_ref->{$attribute}[$i] = $new_plot_ref->{$attribute}[$j]; + } + + # If the color was not already specified for this particular plot + # and for this particular data index, then there were no more + # colors in the plot definition, so get the proper color from the + # configuration file. Do not copy the color from the new plot, + # since the new plot in the merged image will have a different + # index into the color list. + unless (defined $existing_plot_ref->{color}[$i]) { + $existing_plot_ref->{color}[$i] = data_index_to_color($i); + } + + ++$i; + } + + if ($number_plots_added) { + $self->_update_graph_options; + } +} + sub add_rrds { my $self = shift; Modified: trunk/orca/lib/Orca/SourceFile.pm ============================================================================== --- trunk/orca/lib/Orca/SourceFile.pm (original) +++ trunk/orca/lib/Orca/SourceFile.pm Sun Jun 13 15:45:12 2004 @@ -346,7 +346,8 @@ $i = $oldest_regexp_index; } - my $plot = $config_plots[$i]; + my $original_plot = $config_plots[$i]; + my $plot = $original_plot; # Skip this plot if the source group indexes does not match. # Increment the index of the next plot to handle. @@ -383,8 +384,11 @@ } # 1) Regular expression match in the first data with no additional datas. + my $plot_has_only_one_data_with_regexp = 0; if ($number_datas == 1 and $regexp_element_index != -1) { + $plot_has_only_one_data_with_regexp = 1; + # If we've gone up to the last column to match, then go on. if ($regexp_pos[$i] >= @column_description) { if ($oldest_regexp_index == $i) { @@ -743,10 +747,43 @@ } } - # Generate a new plot for these data. - my $image; - my $all_names_with_subgroup = join(',', @names_with_subgroup); - if (defined ($image = $image_files_ref->{hash}{$all_names_with_subgroup})){ + # Generate a name for this image that is used to look up already + # created Orca::Image objects. Normally, the name will contain + # all the column names that matched the data lines in the + # configuration file. However, if a plot has only one data line + # and that data line has a regular expression match in it, then + # this method will generate a different image for all input data + # files that contain different combinations of matching column + # names. For this case, do not store the column names that match, + # use a stringified form of the original data line with a + # 'volatile' tag in it to help ensure that there are no name + # collisions. Also, shorten the two arrays that contain the + # matching column names to a contain single element with the name + # of the data line that generated the image with no mention of the + # names of the matched columns. + my $all_names_with_subgroup; + if ($plot_has_only_one_data_with_regexp) { + $all_names_with_subgroup = join('_', + $group_name, + $subgroup_name, + lc($plot->{data_type}[0]), + 'volatile', + @{$original_plot->{data}[0]}); + @my_short_rrds = ($all_names_with_subgroup); + @names_without_subgroup = (join('_', + $group_name, + lc($plot->{data_type}[0]), + 'volatile', + @{$original_plot->{data}[0]})); + } else { + $all_names_with_subgroup = join(',', sort @names_with_subgroup); + } + + my $image = $image_files_ref->{hash}{$all_names_with_subgroup}; + if (defined $image) { + if ($plot_has_only_one_data_with_regexp) { + $image->add_additional_plot($plot); + } $image->add_rrds(@my_rrds); } else { $image = Orca::ImageFile->new($group_index, From blair at orcaware.com Mon Jun 14 20:05:32 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 14 Jun 2004 20:05:32 -0700 Subject: [Orca-checkins] r349 - trunk/orca Message-ID: <200406150305.i5F35Wpb020271@orcaware.com> Author: blair Date: Mon Jun 14 20:03:18 2004 New Revision: 349 Added: trunk/orca/README.DEVELOPERS - copied, changed from r346, trunk/orca/HACKING Removed: trunk/orca/HACKING Log: * README.DEVELOPERS: Renamed from HACKING to work around the Aladdin's eSafe download filters that prevents downloading the Orca tarball because they contain the word 'hacking'. Copied: trunk/orca/README.DEVELOPERS (from r346, trunk/orca/HACKING) ============================================================================== --- trunk/orca/HACKING (original) +++ trunk/orca/README.DEVELOPERS Mon Jun 14 20:03:18 2004 @@ -3,9 +3,9 @@ If you are contributing code to the Orca project, please read this first. - ====================== - HACKER'S GUIDE TO ORCA - ====================== + ========================== + DEVELOPERS'S GUIDE TO ORCA + ========================== $LastChangedDate: 2002-11-07 09:30:37 -0800 (Thu, 07 Nov 2002) $ From blair at orcaware.com Tue Jun 22 21:35:47 2004 From: blair at orcaware.com (Blair Zajac) Date: Tue, 22 Jun 2004 21:35:47 -0700 Subject: [Orca-checkins] r359 - in trunk/orca: lib/Orca orca Message-ID: <200406230435.i5N4Zlxo016746@orcaware.com> Author: blair Date: Tue Jun 22 21:32:59 2004 New Revision: 359 Modified: trunk/orca/lib/Orca/Config.pm trunk/orca/lib/Orca/ImageFile.pm trunk/orca/lib/Orca/SourceFile.pm trunk/orca/orca/orca.pl.in Log: In the plot hash references created in Orca::Config, rename the 'creates' hash key which contains an array of Orca::ImageFile's to 'created_orca_images' because just by looking at the code, it's was not clear what was created. Even I forgot what was being created :) * lib/Orca/Config.pm, * lib/Orca/ImageFile.pm, * lib/Orca/SourceFile.pm, * orca/orca.pl.in, s/creates/created_orca_images/. Modified: trunk/orca/lib/Orca/Config.pm ============================================================================== --- trunk/orca/lib/Orca/Config.pm (original) +++ trunk/orca/lib/Orca/Config.pm Tue Jun 22 21:32:59 2004 @@ -729,7 +729,7 @@ # Create an array for each plot that will have a list of images that # were generated from this plot. - $plot->{creates} = []; + $plot->{created_orca_images} = []; # Set any optional plot parameters to '' if it isn't defined in # the configuration file. Modified: trunk/orca/lib/Orca/ImageFile.pm ============================================================================== --- trunk/orca/lib/Orca/ImageFile.pm (original) +++ trunk/orca/lib/Orca/ImageFile.pm Tue Jun 22 21:32:59 2004 @@ -82,7 +82,7 @@ $name = name_to_fsname($name, $max_length); # Create the paths to the html directory and subdirectories. - my $html_dir = "$config_global{html_dir}/$subgroup_name"; + my $html_dir = "$config_global{html_dir}/$subgroup_name"; # Create the html_dir directories if necessary. unless (-d $html_dir) { @@ -241,13 +241,12 @@ # For those attributes of the new plot that are array references # and need to be indexed for the particular data being plotted, - # copy them over. Skip the 'creates' attribute which is not used - # for plotting and skip the color attribute as the color is - # treated - # specially. + # copy them over. Skip the 'created_orca_images' attribute which + # is not used for plotting and skip the color attribute as the + # color is treated specially. for my $attribute (keys %$new_plot_ref) { next if $attribute eq 'color'; - next if $attribute eq 'creates'; + next if $attribute eq 'created_orca_images'; next unless UNIVERSAL::isa($new_plot_ref->{$attribute}, 'ARRAY'); $existing_plot_ref->{$attribute}[$i] = $new_plot_ref->{$attribute}[$j]; } Modified: trunk/orca/lib/Orca/SourceFile.pm ============================================================================== --- trunk/orca/lib/Orca/SourceFile.pm (original) +++ trunk/orca/lib/Orca/SourceFile.pm Tue Jun 22 21:32:59 2004 @@ -257,24 +257,25 @@ # XXX # Utility function make a deep clone one of the plots in the -# config_plots array, except for the 'creates' hash key. This should -# really be a method for a single plot, but the plot is not an object -# right now, so it doesn't have any methods that can be given to it. +# config_plots array, except for the 'created_orca_images' hash key. +# This should really be a method for a single plot, but the plot is +# not an object right now, so it doesn't have any methods that can be +# given to it. sub deep_clone_plot { - my $plot = shift; - my $restore_creates = shift; + my $plot = shift; + my $restore_created_orca_images = shift; - # Be careful not to make a deep copy of the 'creates' reference, - # since it can cause recursion. - my $creates = delete $plot->{creates}; - my $new_plot = dclone($plot); - $plot->{creates} = $creates; - if ($restore_creates) { - $new_plot->{creates} = $creates; + # Be careful not to make a deep copy of the 'created_orca_images' + # reference, since it can cause recursion. + my $created_orca_images = delete $plot->{created_orca_images}; + my $new_plot = dclone($plot); + $plot->{created_orca_images} = $created_orca_images; + if ($restore_created_orca_images) { + $new_plot->{created_orca_images} = $created_orca_images; } if (wantarray) { - ($new_plot, $creates); + ($new_plot, $created_orca_images); } else { $new_plot; } @@ -518,12 +519,12 @@ # caused the match. Then create string form of the plot object # using Data::Dumper::Dumper and replace all of the $1, $2, # ... with what was matched in the first data source. - my $creates; - ($plot, $creates) = deep_clone_plot($plot, 0); + my $created_orca_images; + ($plot, $created_orca_images) = deep_clone_plot($plot, 0); $plot->{data}[0][$regexp_element_index] = $column_description; - my $d = Data::Dumper->Dump([$plot], [qw(plot)]); - $plot->{creates} = $creates; - my $count = 1; + my $d = Data::Dumper->Dump([$plot], [qw(plot)]); + $plot->{created_orca_images} = $created_orca_images; + my $count = 1; foreach my $match (@matches) { $d =~ s/\$$count/$match/mge; $d =~ s/\(.+\)/$match/mge; @@ -795,7 +796,7 @@ \@my_rrds); $image_files_ref->{hash}{$all_names_with_subgroup} = $image; push(@{$image_files_ref->{list}}, $image); - push(@{$config_plots[$old_i]{creates}}, $image); + push(@{$config_plots[$old_i]{created_orca_images}}, $image); } # Put into each RRD the images that are generated from it. Modified: trunk/orca/orca/orca.pl.in ============================================================================== --- trunk/orca/orca/orca.pl.in (original) +++ trunk/orca/orca/orca.pl.in Tue Jun 22 21:32:59 2004 @@ -794,8 +794,8 @@ # Go through all of the configured plots. foreach my $config_plot (@config_plots) { - my $plot_creates = $config_plot->{creates}; - next unless @$plot_creates; + my $created_orca_images = $config_plot->{created_orca_images}; + next unless @$created_orca_images; my $group_index = $config_plot->{source_index}; my $group_name = $config_groups_names[$group_index]; @@ -812,7 +812,7 @@ # have the same legend name. my %image_legend_no_subgroup; my %same_legends_image_list; - foreach my $image (@$plot_creates) { + foreach my $image (@$created_orca_images) { my $legend_no_subgroup = replace_subgroup_name($image->plot_ref->{title}, ''); $image_legend_no_subgroup{$image} = $legend_no_subgroup; From blair at orcaware.com Mon Jun 28 21:08:24 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 28 Jun 2004 21:08:24 -0700 Subject: [Orca-checkins] r361 - trunk/orca/lib/Orca Message-ID: <200406290408.i5T48NvR014909@orcaware.com> Author: blair Date: Mon Jun 28 21:06:02 2004 New Revision: 361 Modified: trunk/orca/lib/Orca/Config.pm Log: * lib/Orca/Config.pm (check_config): Return a validation error on the configuration file if html_dir and rrd_dir are identical. Modified: trunk/orca/lib/Orca/Config.pm ============================================================================== --- trunk/orca/lib/Orca/Config.pm (original) +++ trunk/orca/lib/Orca/Config.pm Mon Jun 28 21:06:02 2004 @@ -406,6 +406,14 @@ } } + # Having a single directory used for the html_dir and the rrd_dir is + # not a supported configuration. + if ($config_global{html_dir} eq $config_global{rrd_dir}) { + my $dir = $config_global{html_dir}; + warn "$0: error: 'html_dir' and 'rrd_dir' '$dir' are identical.\n"; + ++$number_errors; + } + # Set any optional global parameters to '' if it isn't defined in # the configuration file. foreach my $option (@cc_default_is_false_global) { From blair at orcaware.com Mon Jun 28 22:59:27 2004 From: blair at orcaware.com (Blair Zajac) Date: Mon, 28 Jun 2004 22:59:27 -0700 Subject: [Orca-checkins] r362 - trunk/orca/data_gatherers/orcallator Message-ID: <200406290559.i5T5xR4A020031@orcaware.com> Author: blair Date: Mon Jun 28 22:57:33 2004 New Revision: 362 Modified: trunk/orca/data_gatherers/orcallator/orcallator.se Log: Orcallator.se sometimes sleeps too long so that the recorded timestamps are not integer multiples of the measurement interval. Patch submitted by Dmitry Berezin . * data_gatherers/orcallator/orcallator.se (orca_sleep_till): New function that sleeps to the specified second. Uses microsecond sleeps to have the process wake up as close as possible to the beginning of the given second. (sleep_till_and_count_new_processes), (measure_web): Use orca_sleep_till() instead of sleep(). Never sleep past the specified sleep to time. Modified: trunk/orca/data_gatherers/orcallator/orcallator.se ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.se (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.se Mon Jun 28 22:57:33 2004 @@ -1196,11 +1196,29 @@ put_output("DNnsrkcmdit", states); } +// This function puts the program to sleep until the beginning of the +// sleep_till second (as measured in the number of seconds from the +// Unix Epoch (00:00:00 UTC, January 1, 1970)) using microsecond sleep +// intervals to wake from sleep as close to the beginning of the +// sleep_till second as possible. +orca_sleep_till(long sleep_till) +{ + timeval_t now[1]; + ulong time_to_sleep; + + gettimeofday(now, 0); + time_to_sleep = sleep_till - now[0].tv_sec; + while (time_to_sleep > 0) { + usleep(1000000*time_to_sleep - now[0].tv_usec); + gettimeofday(now, 0); + time_to_sleep = sleep_till - now[0].tv_sec; + } +} + sleep_till_and_count_new_processes(long sleep_till) { long now; #ifdef WATCH_CPU - long sleep_till1; int mpid5_diff; double mpid5_interval; double rate; @@ -1210,11 +1228,12 @@ while (now < sleep_till) { #ifdef WATCH_CPU if (can_read_kernel != 0) { - // Sleep at least 5 seconds to make a measurement. - sleep_till1 = now + 5; - while (now < sleep_till1) { - sleep(sleep_till1 - now); - now = time(0); + // Sleep for 5 seconds to make a measurement or less to stay + // within the sleep_till limit. + if (now + 5 < sleep_till) { + orca_sleep_till(now + 5); + } else { + orca_sleep_till(sleep_till); } // Measure the 5 second process creation rate. @@ -1243,10 +1262,10 @@ mpid_now = mpid5_now; } else { - sleep(sleep_till - now); + orca_sleep_till(sleep_till); } #else - sleep(sleep_till - now); + orca_sleep_till(sleep_till); #endif now = time(0); } @@ -2050,6 +2069,7 @@ char buf[BUFSIZ]; int i; long now; + long sleep_till_tmp; httpops = 0.0; httpops5 = 0.0; @@ -2089,11 +2109,17 @@ if (www_log_filename != nil) { now = time(0); while (now < sleep_till) { + if (now + 5 < sleep_till) { + sleep_till_tmp = now + 5; + } else { + sleep_till_tmp = sleep_till; + } #ifdef WATCH_CPU - sleep_till_and_count_new_processes(now + 5); + sleep_till_and_count_new_processes(sleep_till_tmp); #else - sleep(5); + orca_sleep_till(sleep_till_tmp); #endif + now = time(0); if (www_log_fp != 0) { buf[BUFSIZ-1] = 127; From blair at orcaware.com Wed Jun 30 22:52:02 2004 From: blair at orcaware.com (Blair Zajac) Date: Wed, 30 Jun 2004 22:52:02 -0700 Subject: [Orca-checkins] r363 - in trunk/orca: . data_gatherers data_gatherers/winallator Message-ID: <200407010552.i615q2xO026506@orcaware.com> Author: blair Date: Wed Jun 30 22:50:13 2004 New Revision: 363 Added: trunk/orca/data_gatherers/winallator/ trunk/orca/data_gatherers/winallator/Makefile.in - copied, changed from r359, trunk/orca/data_gatherers/orcallator/Makefile.in trunk/orca/data_gatherers/winallator/README trunk/orca/data_gatherers/winallator/SourceFile.pm-patch-with-r362.txt trunk/orca/data_gatherers/winallator/winallator.cfg.in (contents, props changed) trunk/orca/data_gatherers/winallator/winallator.htm (contents, props changed) Modified: trunk/orca/configure.in trunk/orca/data_gatherers/Makefile.in Log: Initial commit of the winallator data measurement tools for Windows systems. Winallator used be called OrcaNT. * data_gatherers/winallator: New directory. * data_gatherers/winallator/Makefile.in: Copied from data_gatherers/orcallator/Makefile.in and heavily modified. * data_gatherers/winallator/README: New file describing how to use winallator. * data_gatherers/winallator/SourceFile.pm-patch-with-r362.txt: New file that patches SourceFile.pm for use with the *.tsv files generated by the Windows Performance Monitor. * data_gatherers/winallator/winallator.cfg.in: New file. Initial Orca configuration file for winallator. * data_gatherers/winallator/winallator.htm: New file. A sample Windows Performance Monitor configuration file to quickly set up a set of measurements. * configure.in: Add a new command line option --disable-winallator to disable descending into and building in data_gatherers/winallator. * data_gatherers/Makefile.in: $(WINALLATOR_SUBDIR): New variable that is set by configure. $(SUBDIRS): Add $(WINALLATOR_SUBDIR) to SUBDIRS. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in Wed Jun 30 22:50:13 2004 @@ -297,6 +297,21 @@ AC_SUBST(BUILD_PROCALLATOR) AC_SUBST(PROCALLATOR_SUBDIR) +BUILD_WINALLATOR=yes +WINALLATOR_SUBDIR=winallator +AC_ARG_ENABLE(winallator, + AC_HELP_STRING([--disable-winallator], + [Do not enable building and installing winallator]), + [ + if test "$enableval" = no; then + BUILD_WINALLATOR=no + WINALLATOR_SUBDIR= + fi + ] +) +AC_SUBST(BUILD_WINALLATOR) +AC_SUBST(WINALLATOR_SUBDIR) + # To get a default CFLAGS for this build, check for a C compiler. This # is also needed to be ready to compile any Perl modules. AC_PROG_CC @@ -648,6 +663,11 @@ data_gatherers/procallator/S99procallator.sh" fi +if test "$BUILD_WINALLATOR" = yes; then + OUTPUT_WINALLATOR="data_gatherers/winallator/Makefile + data_gatherers/winallator/winallator.cfg" +fi + AC_OUTPUT(Makefile config/PerlHead1 config/PerlHead2 @@ -660,6 +680,7 @@ $OUTPUT_ORCALLATOR $OUTPUT_ORCA_SERVICES $OUTPUT_PROCALLATOR + $OUTPUT_WINALLATOR docs/Makefile lib/Makefile packages/Makefile Modified: trunk/orca/data_gatherers/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/Makefile.in (original) +++ trunk/orca/data_gatherers/Makefile.in Wed Jun 30 22:50:13 2004 @@ -5,12 +5,14 @@ ORCALLATOR_SUBDIR = @ORCALLATOR_SUBDIR@ ORCA_SERVICES_SUBDIR = @ORCA_SERVICES_SUBDIR@ PROCALLATOR_SUBDIR = @PROCALLATOR_SUBDIR@ +WINALLATOR_SUBDIR = @WINALLATOR_SUBDIR@ SUBDIRS = $(AIXALLATOR_SUBDIR) \ $(HPALLATOR_SUBDIR) \ $(ORCALLATOR_SUBDIR) \ $(ORCA_SERVICES_SUBDIR) \ - $(PROCALLATOR_SUBDIR) + $(PROCALLATOR_SUBDIR) \ + $(WINALLATOR_SUBDIR) all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ Copied: trunk/orca/data_gatherers/winallator/Makefile.in (from r359, trunk/orca/data_gatherers/orcallator/Makefile.in) ============================================================================== --- trunk/orca/data_gatherers/orcallator/Makefile.in (original) +++ trunk/orca/data_gatherers/winallator/Makefile.in Wed Jun 30 22:50:13 2004 @@ -8,27 +8,21 @@ sysconfdir = @sysconfdir@ INSTALL = @INSTALL@ MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ VAR_DIR = @VAR_DIR@ RRD_DIR = @RRD_DIR@ -INIT_D_DIR = @INIT_D_DIR@ -RCX_D_CONTAINING_DIR = @RCX_D_CONTAINING_DIR@ -RAW_ORCALLATOR_DIR = $(VAR_DIR)/orcallator -RRD_ORCALLATOR_DIR = $(RRD_DIR)/orcallator +RAW_WINALLATOR_DIR = $(VAR_DIR)/winallator +RRD_WINALLATOR_DIR = $(RRD_DIR)/winallator -BIN_PERL_SCRIPTS = orcallator_column \ - orcallator_running +BIN_PERL_SCRIPTS = LIBEXEC_PERL_SCRIPTS = NOINST_PERL_SCRIPTS = PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ $(LIBEXEC_PERL_SCRIPTS) \ $(NOINST_PERL_SCRIPTS) -BIN_SHELL_SCRIPTS = restart_orcallator \ - stop_orcallator \ - start_orcallator +BIN_SHELL_SCRIPTS = LIBEXEC_SHELL_SCRIPTS = -NOINST_SHELL_SCRIPTS = S99orcallator +NOINST_SHELL_SCRIPTS = SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) \ $(NOINST_SHELL_SCRIPTS) @@ -40,75 +34,35 @@ LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) -all: Makefile $(TARGETS) orcallator.cfg +all: Makefile $(TARGETS) winallator.cfg install: all $(MKDIR) $(bindir) $(MKDIR) $(libdir) $(MKDIR) $(sysconfdir) - $(MKDIR) $(RAW_ORCALLATOR_DIR) - $(MKDIR) $(RRD_ORCALLATOR_DIR) + $(MKDIR) $(RAW_WINALLATOR_DIR) + $(MKDIR) $(RRD_WINALLATOR_DIR) @for file in $(BIN_TARGETS); do \ echo $(INSTALL) $$file $(bindir); \ $(INSTALL) $$file $(bindir); \ done - $(INSTALL) -m 0644 orcallator.se $(libdir) - @if test -r $(sysconfdir)/orcallator.cfg; then \ + @if test -r $(sysconfdir)/winallator.cfg; then \ date="`date +%Y-%m-%d-%H:%M:%S`"; \ - echo $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir)/orcallator.cfg.$$date; \ - $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir)/orcallator.cfg.$$date; \ + echo $(INSTALL) -m 0644 winallator.cfg $(sysconfdir)/winallator.cfg.$$date; \ + $(INSTALL) -m 0644 winallator.cfg $(sysconfdir)/winallator.cfg.$$date; \ else \ - echo $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir); \ - $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir); \ + echo $(INSTALL) -m 0644 winallator.cfg $(sysconfdir); \ + $(INSTALL) -m 0644 winallator.cfg $(sysconfdir); \ fi -orcallator_run_at_boot: all - test "$(INIT_D_DIR)" - test "$(RCX_D_CONTAINING_DIR)" - -$(RM) $(INIT_D_DIR)/orcallator - -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01orcallator - -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01orcallator - -$(RM) $(RCX_D_CONTAINING_DIR)/rc2.d/K01orcallator - -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99orcallator - $(INSTALL) -m 0744 S99orcallator $(INIT_D_DIR)/orcallator - ln -s $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc0.d/K01orcallator - ln -s $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc1.d/K01orcallator - ln -s $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc2.d/K01orcallator - ln -s $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc3.d/S99orcallator - clean: $(RM) $(TARGETS) distclean: clean - $(RM) *.sh orcallator.cfg orcallator_running.pl Makefile - -.SUFFIXES: .pl .sh - -.pl: $(PERL_HEAD) - cat $(PERL_HEAD) $< > $@ - chmod 0755 $@ - -.sh: - cp $< $@ - chmod 0755 $@ + $(RM) winallator.cfg Makefile Makefile: Makefile.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/Makefile ./config.status - -orcallator.cfg: orcallator.cfg.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/orcallator.cfg ./config.status - -orcallator_running.pl: orcallator_running.pl.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/orcallator_running.pl ./config.status - -restart_orcallator.sh: restart_orcallator.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/restart_orcallator.sh ./config.status - -start_orcallator.sh: start_orcallator.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/start_orcallator.sh ./config.status - -stop_orcallator.sh: stop_orcallator.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/stop_orcallator.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/winallator/Makefile ./config.status -S99orcallator.sh: S99orcallator.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orcallator/S99orcallator.sh ./config.status +winallator.cfg: winallator.cfg.in + cd ../.. && CONFIG_FILES=data_gatherers/winallator/winallator.cfg ./config.status Added: trunk/orca/data_gatherers/winallator/README ============================================================================== --- (empty file) +++ trunk/orca/data_gatherers/winallator/README Wed Jun 30 22:50:13 2004 @@ -0,0 +1,126 @@ +How To Collect Performance Data For Windows 2000/XP Systems +=========================================================== + +This tool used to be referred to as orcaNT. It is now named +winallator for two reasons. First, since it is a data measurement +tool and not a data plotting tool, it deserves a name for a data +gatherer. Second, the orcaNT portion of the original orcaNT package +was just a patch to orca.pl that removed the call to 'ps aux' and +reducing the package requirements. + +To follow in the tracks of the other *allator tools, this package was +renamed winallator. + + 1. From a Command Prompt, Cygwin Shell or the Start->Run, type + + perfmon + + 2. Click on "Performance Logs and Alerts" and expand on the left hand + column under "Console Root". + + 3. Create a patched copy of Orca. Currently Orca needs a patched + version of SourceFile.pm handle the Performance Monitor's log + files. This patched version may not work with any other versions + input data files. + + a) Get a copy of the Orca source tree on the system that will + process the Winallator log files. + + b) Find the SourceFile.pm-patch-with-r362.txt file and note where + it is. + + c) cd into the $prefix/lib/Orca directory, where $prefix is where + you installed your Orca. + + c) Apply the patch by running: + + cp -p SourceFile.pm SourceFile.FCS + patch -s -p0 < path/to/SourceFile.pm-patch-with-r362.txt + + 4. You have two choices now. The first and easy choice is to load in + a previously designed log configuration. You can always modify + the settings later if you want, using the instructions below for + the advanced setup. + + 5. Simple setup. + + a) Download a copy of the winallator.htm file located in this + directory to your Windows system. + + b) Right-click on "Counter Logs" and choose "New Log Settings + From...". Find and open the downloaded winallator.htm in the + open file dialog box. + + c) Give the new log settings a name that does not appear in the + Performance Monitor window and click OK. + + d) The loaded settings here will record a number of different + measurements into log files in the C:\WinallatorLogs directory. + + e) To end the simple setup, click OK. Data will be recorded + immediately into the C:\WinallatorLogs directory. If they are + not, then right click on the new Winallator name and select + "Start". For the advanced setup, continue reading at step 6c. + + f) Click OK to begin recording data. + + 6. Advanced Setup. + + a) Right-click on "Counter Logs" and choose "New Log Settings..." + + b) Give the new log settings a name that does not appear in the + Performance Monitor window and click OK. + + c) This opens up a window with three tabs "General", "Log Files", + and "Schedule". + + d) Select "General->Add Counters..." This opens the Add Counters + window. + + e) Now... + - Choose "Select counters from computer:". + + - Performance object. + This is the category like Processor, Network Interface, etc. + Choose what you want here. + + - Either choose "All counters" or be selective and choose the + counters you are interested in. For more information on one, + click on the counter and then click on the "Explain" button. + Select counter from the list. + + - Select the instances you want from the list. + + f) Click "Add". This will add the counter to previous window + without closing the window, so you can quickly select other + counters. Click "Close" when you are done adding all the + counters. + + g) Back to the "General" tab. + Change the "Sample data every:" to "5 minutes". + + h) Leave "Run As: as "". + + i) Click on the "Log Files" tab. + + j) Change the "Log file type:" to "Text File (Tab delimited)". + + k) Click on the "Configure" button. + Enter the "Location" as "C:\WinallatorLogs\MachineName". + Change the "File name" to "winallator". + Set the "Log file size" to "Maximum limit". + Select OK. + + l) Back on the "Log Files" tab. + Select "End Filenames with:" as "yyyymmddhh". + It will show the example path and filename. + + m) Select the "Schedule" tab. + Set "Start Log" to "At: 12:00:00 AM" on any date. + Set "Stop Log" to "After 1 unit: days". + Turn on "When a log file closes: Start a new log file". + + n) Select OK and the new log settings should be set. + + o) If you see it not started just right click on the counter log + name on the right hand side window and select start. Added: trunk/orca/data_gatherers/winallator/SourceFile.pm-patch-with-r362.txt ============================================================================== --- (empty file) +++ trunk/orca/data_gatherers/winallator/SourceFile.pm-patch-with-r362.txt Wed Jun 30 22:50:13 2004 @@ -0,0 +1,136 @@ +Index: SourceFile.pm +=================================================================== +--- SourceFile.pm (revision 362) ++++ SourceFile.pm (working copy) +@@ -31,6 +31,10 @@ + use Orca::Utils qw(email_message); + use vars qw(@ISA $VERSION); + ++# Andy Fox - 2nd July 2002 ++# We need this to convert time into Unix Epoch Time. ++use Time::Local; ++ + @ISA = qw(Orca::DataFile); + $VERSION = substr q$Revision: 0.01 $, 10; + +@@ -153,9 +157,39 @@ + return unless $fd; + my $line = <$fd>; + chomp($line); ++ ++ # Andy Fox - 2nd July 2002 ++ # Take the first line (headers) and convert it into a format Orca can understand ++ + if ($line) { + $self->[I_FIRST_LINE] = 1; +- @column_description = split(' ', $line); ++ $_ = $line; ++ s/ /_/g; ++ s/\\\\[^\\ ]+\\//g; ++ s/"//g; ++ s/\\/_/g; ++ s/\?//g; ++ s/\(/_/g; ++ s/\)/_/g; ++ s/,//g; ++ s/://g; ++ s/\?//g; ++ s/__/_/g; ++ s/__/_/g; ++ ++ $line = $_; ++ print "$line\n"; ++ ++ # Andy Fox - 2nd July 2002 ++ # Changed this to a tab (was a space), so it can read tsv format files ++ ++ @column_description = split(' ', $line); ++ ++ # Andy Fox - 2nd July 2002 ++ # Set the first field of the first line 'timestamp' ++ ++ $column_description[0]="timestamp"; ++ + } else { + warn "$0: warning: no first_line for '$filename' yet.\n"; + $open_file_cache->close($fid) or +@@ -921,8 +955,19 @@ + # in the output file when it starts up. + next if $line =~ /timestamp/; + +- my @line = split(' ', $line); ++print "$line\n"; ++$_ = $line; ++s/ /:/g; ++s/"//g; ++$line = $_; + ++ # Andy Fox - 2nd July 2002 ++ # Changed this to a tab (was a space), so it can read tsv format files ++ my @line = split(' ', $line); ++ ++ ##ANDY## ++ #print "@line\n"; ++ + # Skip this input line if 1) the file uses the first line to + # define the column names, 2) the number of columns loaded is not + # equal to the number of columns in the column description. +@@ -940,6 +985,58 @@ + } else { + $time = $line[$date_column_index]; + } ++#ANDY# ++#print "$time\n"; ++ ++# At this stage the date is in this format: 06/18/2002 21:56:06.096 ++ ++$_ = $time; ++s/\//:/g; ++#print "$_\n"; ++#s/ /:/; ++#print "$_\n"; ++s/\./:/; ++#print "$_\n"; ++#$newtime = $_; ++#s/"//g; ++#print "$_\n"; ++ ++# Now we have this: "06:18:2002:21:56:06:096" ++ ++my @andy = split(':', $_); ++ ++my ($sec); ++my ($min); ++my ($hr); ++my ($day); ++my ($mon); ++my ($yr); ++ ++$mon = $andy[0]; ++$day = $andy[1]; ++$yr = $andy[2]; ++$hr = $andy[3]; ++$min = $andy[4]; ++$sec = $andy[5]; ++ ++#print "mon = $mon\n"; ++#print "day = $day\n"; ++#print "yr = $yr\n"; ++#print "hr = $hr\n"; ++#print "min = $min\n"; ++#print "sec = $sec\n"; ++ ++$mon -= 1; ++$yr -= 1900; ++#print "yr = $yr\n"; ++ ++my ($blur); ++$blur = timelocal($sec, $min, $hr, $day, $mon, $yr); ++#print "time is now $blur\n"; ++ ++$time = $blur; ++print "$time\n"; ++ + $last_data_time = $time if $time > $last_data_time; + + # If the file status from the source data file is greater than Added: trunk/orca/data_gatherers/winallator/winallator.cfg.in ============================================================================== --- (empty file) +++ trunk/orca/data_gatherers/winallator/winallator.cfg.in Wed Jun 30 22:50:13 2004 @@ -0,0 +1,359 @@ +# Orca configuration file for Windows Performance Monitor log files. + +# $HeadURL$ +# $LastChangedRevision$ +# $LastChangedDate$ +# $LastChangedBy$ + +# Require at least this version of Orca. +require Orca 0.28.0 + +# base_dir is prepended to the paths find_files, html_dir, rrd_dir, +# and state_file only if the path does not match the regular +# expression ^\\?\.{0,2}/, which matches /, ./, ../, and \./. +base_dir @RRD_DIR@/winallator + +# rrd_dir specifies the location of the generated RRD data files. If +# rrd_dir is a relative path, then it is made relative to base_dir if +# base_dir is set. +rrd_dir . + +# state_file specifies the location of the state file that remembers +# the modification time of each source data file. If state_file is a +# relative path, then it is made relative to base_dir is base_dir is +# set. +state_file orca.state + +# html_dir specifies the top of the HTML tree created by Orca. +html_dir @HTML_DIR@/winallator + +# By default create .meta tag files for all PNGs or GIFs so that the +# web browser will automatically reload them. +expire_images 1 + +# Find files at the following times: +# 0:10 to pick up new orcallator files for the new day. +# 1:00 to pick up late comer orcallator files for the new day. +# 6:00 to pick up new files before the working day. +# 12:00 to pick up new files during the working day. +# 19:00 to pick up new files after the working day. +find_times 0:10 1:00 6:00 12:00 19:00 + +# This defines the email address of people to warn when a file that is +# being updated constantly stops being updated. For mathematical +# expressions use the word 'interval' to get the interval number for +# the data source. +warn_email @WARN_EMAIL@ +late_interval interval + 30 + +# These parameters specify which plots to generate. +generate_hourly_plot 0 +generate_daily_plot 1 +generate_weekly_plot 1 +generate_monthly_plot 1 +generate_quarterly_plot 1 +generate_yearly_plot 1 + +# This sets the HTML markup that is placed at the very top of every +# web page and is primarily used to display the site's logo. +html_page_header

Put your site's logo here.

+ +# This sets the text, that should not be HTML markup, that is used +# only in the main index.html file. It is used in the +# element and also placed in the HTML body after the html_page_header +# in a

element index.html file. +html_top_title Windows Status + +# This sets the HTML markup that is placed at the bottom of every web +# page. +html_page_footer + + These plots brought to you by your local system administrator. + + +# This defines where the find the source data files and the format of +# those files. Notes about the fields: +# find_files +# You'll notice that all but the first () has the form (?:...). +# This tells Perl to match the expression but not save the matched +# text in the $1, $2, variables. Orca uses the matched text to +# generate a subgroup name, which is used to place files into +# different subgroups. Here, only the hostname should be used to +# generate a subgroup name, hence all the (?:...) for matching +# anything else. +# interval +# The interval here must match the interval used by orcallator to +# record data. Do not change this, as it has an effect on the +# generated RRD data files. + +group winallator { +find_files @VAR_DIR@/winallator/(.*)/winallator_\d{10}\.tsv +column_description first_line +date_source column_name timestamp +interval 300 +filename_compare sub { + my ($ay, $am, $ad) = $a =~ /_(\d{4})(\d\d)(\d\d)/; + my ($by, $bm, $bd) = $b =~ /_(\d{4})(\d\d)(\d\d)/; + if (my $c = (( $ay <=> $by) || + ( $am <=> $bm) || + (($ad >> 3) <=> ($bd >> 3)))) { + return 2*$c; + } + $ad <=> $bd; + } +} + +plot { +title %g Memory Available (Bytes) +source winallator +data Memory_Available +line_type area +legend Memory +y_legend Bytes +data_min 0 +data_max 1000000000000 +rigid_min_max 1 +} + +plot { +title %g Memory Pages/sec +source winallator +data Memory_Pages/sec +line_type area +legend Memory_Page +y_legend Pages/sec +data_min 0 +data_max 1000000000000 +rigid_min_max 1 +} + +plot { +title %g Terminal Services Sessions +source winallator +data Terminal_Services_(.*) +line_type line2 +legend $1 +y_legend Users +data_min 0 +data_max 100 +} + +plot { +title %g Terminal Services Active Sessions +source winallator +data Terminal_Services_Active_Sessions +line_type area +legend Active Session +y_legend Users +data_min 0 +} + +plot { +title %g Terminal Services InActive Sessions +source winallator +data Terminal_Services_Inactive_Sessions +line_type area +legend InActive Session +y_legend Users +data_min 0 +} + +plot { +title %g Terminal Services Total Sessions +source winallator +data Terminal_Services_Total_Sessions +line_type area +legend Active Session +y_legend Users +data_min 0 +} + +plot { +title %g Network Interface(s) Bytes/sec +source winallator +data Network_Interface_(.*)_Bytes_Total/sec +line_type line1 +legend $1 +y_legend Bytes/sec +flush_regexps 1 +} + +plot { +title %g Network Interface(s) Output Queue Length +source winallator +data Network_Interface_(.*)_Output_Queue_Length +line_type line1 +legend $1 +y_legend Output Queue Length +flush_regexps 1 +} + +#plot { +#title %g Paging File(s) % Usage +#source winallator +#data Paging_File_([^Total].*)_%_Usage +#line_type area +#legend $1 +#y_legend Percent +#color ff0000 +#} + +plot { +title %g Paging File (Total) % Usage +source winallator +data Paging_File_Total_%_Usage +line_type area +legend Paging File (Total) +y_legend Percent +color ff0000 +} + +#plot { +#title %g PhysicalDisk % Disk Time +#source winallator +#data PhysicalDisk_([^Total].*)_%_Disk_Time +#line_type line1 +#legend Disk $1 +#y_legend Percent +#flush_regexps 1 +#} + +plot { +title %g PhysicalDisk (Total) % Disk Time +source winallator +data PhysicalDisk(_Total)_%_Disk_Time +line_type line1 +legend PhysicalDisk (Total) +y_legend Percent +color ff0000 +} + +plot { +title %g PhysicalDisk Average Disk Queue Length +source winallator +data PhysicalDisk_([^Total].*)_Avg._Disk_Queue_Length +line_type line1 +legend Disk $1 +y_legend Disk Queue Length +flush_regexps 1 +} + +plot { +title %g PhysicalDisk (Total) Average Disk Queue Length +source winallator +data PhysicalDisk(_Total)_Avg._Disk_Queue_Length +line_type line1 +legend PhysicalDisk (Total) +y_legend Disk Queue Length +color ff0000 +} + +plot { +title %g Processor(s) % Privileged Time +source winallator +data Processor_([^Total].*)_%_Privileged_Time +line_type line2 +legend Processor $1 +y_legend Percent +flush_regexps 1 +} + +plot { +title %g Processor(Total) % Privileged Time +source winallator +data Processor(_Total)_%_Privileged_Time +line_type line2 +legend Processor $1 +y_legend Percent +flush_regexps 1 +} + +plot { +title %g Processor(s) % Processor Time +source winallator +data Processor_([^Total].*)_%_Processor_Time +line_type line2 +legend Processor $1 +y_legend Percent +flush_regexps 1 +} + +plot { +title %g Processor(Total) % Processor Time +source winallator +data Processor(_Total)_%_Processor_Time +line_type line1 +legend Processor (Total) +y_legend Percent +} + +plot { +title %g Processor(s) Interrupts/sec +source winallator +data Processor_([^Total].*)_Interrupts/sec +line_type line2 +legend Processor $1 +y_legend Interrupts/sec +flush_regexps 1 +} + +plot { +title %g Processor(s) Total Interrupts/sec +source winallator +data Processor(_Total)_%_Interrupts/sec +line_type line1 +legend Processor (Total) +y_legend Interrupts/sec +color ff0000 +} + +plot { +title %g Server Bytes Total/sec +source winallator +data Server_Bytes_Total/sec +line_type line1 +legend Server Bytes +y_legend Bytes/sec +color ff0000 +} + +plot { +title %g System Context Switches/sec +source winallator +data System_Context_Switches/sec +line_type line1 +legend System Context Switches +y_legend Per second +color ff0000 +} + +plot { +title %g System Processor Queue Length +source winallator +data System_Processor_Queue_Length +line_type line1 +legend System Processor Queue +y_legend Length +color ff0000 +} + +plot { +title %g System Up Time +source winallator +data System_System_Up_Time / 86400 +line_type area +legend Number of Day/s +y_legend Days +data_min 0 +color ff0000 +} + +plot { +title %g Web Service (Total) Current Anonymous Users +source winallator +data Web_Service_Total_Current Anonymous_Users +line_type line1 +legend Current Anonymous Users +y_legend Length +color ff0000 +} Added: trunk/orca/data_gatherers/winallator/winallator.htm ============================================================================== --- (empty file) +++ trunk/orca/data_gatherers/winallator/winallator.htm Wed Jun 30 22:50:13 2004 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +