written by M.Liberi
26 Ottobre 1999
Michele Liberi
Questo pacchetto permette all'amministratore di un gruppo di stazioni di lavoro CATIA in ambiente AIX di ottenere informazioni sull'effettivo utilizzo delle stazioni.
L'interfaccia utente del pacchetto è il programma Xcssr che è in grado di generare quattro tipi di grafici a video o in formato stampante (HPGL,PostScript,etc.), o il programma cpug che è in grado di visualizzare graficamente i soli dati di sistema.
La raccolta dei dati di sistema avviene, su ogni stazione, per mezzo del programma cpudc che normalmente dovrà essere attivato alla partenza della macchina e rimarrà sempre attivo. Esso genera tre files contenenti
La raccolta dei dati relativi alle attività del CATIA avviene, su ogni stazione, a cura del CATIA stesso che si avrà cura di configurare attivando i seguenti parametri:
STAT_DIR = '/tmp'; CATIA.STAT_FILE = 'stat';/* /tmp/stat.account will be generated */ CATIA.STATISTICS = TRUE ; CATIA.VISU_STAT = TRUE ; CATIA.DURATION_STAT = 5; /* min. */ CATIA.MAX_TABLES_STAT = 1500; /* max number of interactions */
Poiché il CATIA genera dei file enormi è opportuno estrarre da essi i soli dati che potranno essere visualizzati. Tale operazione viene fatta dal programma cssr che genera un file circa cento volte più piccolo del file originale.
Tutti i dati così raccolti dovranno essere messi in un'unica directory che costituisce il database di riferimento per il programma di visualizzazione e stampa.
Ogni componente del pacchetto, se attivato con l'opzione -h, genera una schermata che ne spiega la funzione e gli eventuali parametri di configurazione.
I componenti del pacchetto sono:
Xcssr, (c) M.Liberi, ver. 2.01, Oct 1999
graphically reports CATIA & cpu statistics. Four types of graph available:
1. CPU usage:
X-axis reports the number of days from 1/1/1997
Y-axis reports the percentage of cpu usage
each bar reports the starting, ending time, system and total cpu usage.
2. CATIA usage:
for each catia session a rectangle will be displayed
X-axis reports the number of days from 1/1/1997
Y-axis reports the percentage of cpu usage
each bar reports the starting, ending time, % usage.
3. CATIA product usage:
an histogram of relative frequencies of usage for each single
catia product
4. CATIA product usage:
an histogram of relative frequencies of usage for each single
catia function
syntax: Xcssr [option]... [parameter]...
-h this help screen
-w write current parameters to stdout and exit
-g edit global profile '/local/pro/global.pro'
-exx edit profile /local/pro/Xcssrxx.pro
-pxx read parameters from /local/pro/Xcssrxx.pro
-p 'profile' read parameters from 'profile'
-- no more options
-W time display graph for max 'time' sec.
parameters
DCDB the cpu usage & CATIA statistics directory
CPUSFX cpu data suffix (prefix is hostname)
CATSFX CATIA statistics suffix (prefix is hostname)
FreqMin Minimum Relative Frequency for a product/function
in the form VAR=value, can be specified:
1. in command line
2. in '/local/pro/Xcssr.pro'
3. in global profile globpro='/local/pro/global.pro'
4. environment values
5. use default values
current values:
DCDB='/var'
CPUSFX='cpudc.dat'
CATSFX='cssr.dat'
FreqMin='0.2'
WTIME='-1'
cssr, Catia Session Statistics Report, (c) M.Liberi, Jul 3 1998 14:23:00 extract data from a statical file generated by CATIA V4 or newer use the following declarations to generate a CATIA statistical file: CATIA.STAT_DIR = '/tmp'; CATIA.STAT_FILE = 'stat';/* /tmp/stat.account will be generated */ CATIA.STATISTICS = TRUE ; CATIA.VISU_STAT = TRUE ; CATIA.DURATION_STAT = 5; /* min. */ CATIA.MAX_TABLES_STAT = 1500; /* max number of interactions */ Syntax: cssr [option]... filename -h this help screen -u username select only sessions started by 'username' -a account select only sessions started by 'account' -n hostname select only sessions started by 'hostname' -m YYYY.DDD select sessions started after YYYY.DDD 00:00:00 -M YYYY.DDD select sessions started before YYYY.DDD 23:59:59 -e filename extract data to 'filename' -E filename extract data to 'filename' and remove original file -c aggregate data by cpu usage -p aggregate cpu usage data by product name -f aggregate cpu usage data by function name -l full listing of all statistical data -b FreqMin group product/function usage less than FreqMin -t print grand totals -- no more options, next argument is filename
cpudc, (c) M.Liberi, ver. 1.01, Oct 1998 cpudc collects cpu usage data to a file in a format suitable to be later graphically shown by 'cpug'. I suggest to let cpudc be started by 'init' by inserting the following line in /etc/inittab: 'cpudc:2:respawn:cpudc >/dev/null 2>&1' You can later change parameters in '/local/pro/cpudc.pro' and send a kill signal to the running program. init will restart it for you with the new parameters. syntax: cpudc [option]... [parameter]... -h this help screen -w write current parameters to stdout and exit -g edit global profile '/local/pro/global.pro' -exx edit profile /local/pro/cpudcxx.pro -pxx read parameters from /local/pro/cpudcxx.pro -p 'profile' read parameters from 'profile' -r remove old collected data -v print collected data to stdout too -- no more options parameters DELTA the time between two cpu usage relevation DCFILE CPU data collection file IOFILE Page IN/OUT data collection file NETFIL network I/O data collection file DCMLEN the max number of data lines present in each datafile in the form VAR=value, can be specified: 1. in command line 2. in '/local/pro/cpudc.pro' 3. in global profile globpro='/local/pro/global.pro' 4. environment values 5. use default values current values: DELTA='300' DCFILE='/var/mliberi.cpudc.dat' IOFILE='/var/mliberi.piodc.dat' NETFIL='/var/mliberi.netdc.dat' DCMLEN='1008'
cpug, (c) M.Liberi, ver. 1.01, Oct 1998 cpug graphically reports data collected by 'cpudc'. X-axis reports the number of days from 1/1/1997 Y-axis reports the percentage of cpu usage each bar reports the starting, ending time, system and total cpu usage. syntax: cpug [option]... [parameter]... -h this help screen -w write current parameters to stdout and exit -g edit global profile '/local/pro/global.pro' -exx edit profile /local/pro/cpugxx.pro -pxx read parameters from /local/pro/cpugxx.pro -p 'profile' read parameters from 'profile' -m Xmin set Xmin -M Xmax set Xmax -hpgl output in hpgl format -- no more options parameters DCFILE data collection file IOFILE Page IN/OUT data collection file NETFIL network I/O data collection file in the form VAR=value, can be specified: 1. in command line 2. in '/local/pro/cpug.pro' 3. in global profile globpro='/local/pro/global.pro' 4. environment values 5. use default values current values: DCFILE='/var/mliberi.cpudc.dat' IOFILE='/var/mliberi.piodc.dat' NETFIL='/var/mliberi.netdc.dat'
Il pacchetto è in formato tar compresso, per estrarne il contenuto dare il comando:
gzip -dc Xcssr.tgz | tar xvpf -
I file kce e kcr dovranno essere copiati nella directory /bin come utente root
cp -p kce kcr /bin
Ogni macchina di cui si vorranno visualizzare i dati deve essere predisposta alla raccolta degli stessi tramite l'inserimento nel file /etc/inittab della riga che fa partire il comando cpudc, e tramite opportuna configurazione del CATIA affinché generi il file di statistiche.
Ogni macchina dovrà poi alimentare con i propri dati il database da cui il comando Xcssr andrà a leggerli. Consiglio di inserire nel crontab di root il lancio di una procedura che, a intervalli di tempo regolari, copia i dati raccolti nel DB.
Se, ad esempio, il file generato da CATIA è /tmp/stat.account ed il file generato da cpudc è /tmp/cpudc.dat, ed il database è nella directory (nfs?) /archivio/Xcssr.db, ogni macchina dovrà eseguire i seguenti comandi:
cp -p /tmp/cpudc.dat /archivio/Xcssr.db/$(hostname).cpudc.dat cssr -E /archivio/Xcssr.db/$(hostname).cssr.dat /tmp/stat.account
Il file di statistiche generato da CATIA tende rapidamente a diventare enorme e quindi ingestibile. Ciò mi ha indotto a progettare un sistema di estrazione che producesse un file molto più compatto e che contenesse tuttavia tutte le informazioni utili per la generazione dei grafici gestiti da questo pacchetto.
L'operazione di estrazione, che si attua tramite il comando cssr chiamato con l'opzione -e o -E genera un file con il seguente formato:
I primi quattro byte contengono un numero fisso (magic number) che permette il riconoscimento del file da parte del programma cssr. Modificando opportunamente il file di sistema /etc/magic il comando file riconoscerà il formato.
0 long 0x21222324 compressed CATIA statistics file
Segue una lista di sessioni ognuna formata da una testata ed un numero arbitrario di rilevamenti, il cui numero è scritto nella testata.
Il tracciato record della testata è il seguente (C syntax):
struct
{
byte username[8],
account[8],
hostname[3];
float punto_medio,
ampiezza;
longword onwork,
elapsed,
DDTnum;
}
mentre il tracciato record di ogni singolo rilevamento è il seguente:
struct
{
byte PF[12]; /* PRODUCT+FUNCTION */
longword T3_T2; /* T3-T2 */
}
I campi username, account, hostname sono, rispettivamente, il nome dell'utente che ha attivato la sessione, il valore della variabile 'CATIA.ACCOUNT_NUMBER' della sessione, ed infine i primi tre caratteri del 'hostname' sul quale la sessione è stata attivata.
I campi punto_medio, ampiezza servono a posizionare nel tempo la sessione. Entrambi sono espressi in numero di giorni dal 1/1/1996.
I campi onwork,elapsed sono dati consuntivi non presenti nel file di statistiche generato da CATIA. Sono calcolati come somma dei tempi rilevati per ogni singola chiamata a funzione. onwork è il tempo di elaborazione puro, elapsed è invece la durata effettiva. L'unità di misura è il centesimo dei secondo.
Il campo DDTnum indica semplicemente il numero di chiamate a funzione effettuate nella sessione.
Il campo PF contiene il nome del prodotto (4 bytes), e della funzione attivata (8 bytes).
Il campo T3_T2 è il tempo di elaborazione puro della funzione, espresso in centesimi di secondo.
Software Products: Michele Liberi programs and accompanying documentation "Freeware".
Licensor: Michele Liberi, Viale Roma 6, Battaglia Terme (PD), Italy.
This is a legal agreement between you, an end user, and licensor.
By downloading and installing the freeware, you are agreeing to be bound by the terms of this agreement. If you do not agree to the terms of this agreement, do not install this freeware and delete any copies of the freeware that you have downloaded.
This freeware is provided to you free of charge for both commercial and non-commercial purposes. Obtaining a license to this freeware from any party other than licensor and/or paying a fee for such license is strictly forbidden. If you are aware of any unauthorized third party distributing this freeware and/or charging a fee for this freeware, please report such violations to your consumer protection authorities.
This Agreement permits you to use one copy of the Freeware acquired with this license on any single computer ("License") for both commercial and non-commercial purposes, provided the Freeware is in use on only one computer at any given time. The Freeware is "in use" on a computer when it is loaded into the temporary memory or installed into the permanent memory (e.g. hard disk, CD ROM, or other storage device) of that computer, except that a copy installed on a network server for the sole purpose of distribution to other computers is not considered "in use".
The Freeware is owned by Licensor and is protected by copyright laws, international treaty provisions, and other national laws. You agree that you have no right, title or interest in the Freeware, except as set forth in Subsection I.
You may not rent, lease, sell or transfer the Freeware to any third party. You may not reverse engineer, decompile or disassemble the Freeware.
You acknowledge that you have licensed this freeware free of charge and that licensor makes no warranties to you in connection with this license, including but not limited to implied warranties of merchantability, fitness for a particular purpose, title, non-infringement and legality in your country. You agree to defend, indemnify and hold harmless licensor from any and all claims of infringement (including those made by third parties) resulting in whole or in part from your use of the freeware.
In no event shall Licensor be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the Freeware, even if Licensor has been advised of the possibility of such damages.
This Agreement shall be governed by and interpreted in accordance with the laws of Italy. If any dispute shall arise pursuant to any provision of this Agreement, said dispute shall be settled by binding arbitration in accordance with the rules and regulations of the courts, located in Italy. If any term or provision of this Agreement shall be declared invalid in arbitration or by a court of competent jurisdiction, such invalidity shall be limited solely to the specific term or provision invalidated, and the remainder of this Agreement shall remain in full force and effect, according to its terms. Any provision declared invalid shall be modified to the fullest extent possible to reflect the parties intent as of the Effective Date.
Copyright © M.Liberi. All rights reserved.