campo-sirio/cb/source/d4info.c
alex af15e0698b Codebase
git-svn-id: svn://10.65.10.50/trunk@4679 c028cbd2-c16b-5b4b-a496-9718f37d4682
1997-06-16 13:01:08 +00:00

92 lines
2.9 KiB
C
Executable File

/* d4info.c (c)Copyright Sequiter Software Inc., 1988-1996. All rights reserved. */
#include "d4all.h"
#ifndef S4UNIX
#ifdef __TURBOC__
#pragma hdrstop
#endif
#endif
#ifdef S4CLIENT
int S4FUNCTION code4info( CODE4 *c4 )
{
CONNECTION4 *connection ;
int rc ;
#ifdef S4CONSOLE
CONNECTION4SERVER_INFO_OUT *out ;
CONNECTION4CLIENT_INFO *client ;
unsigned short int i ;
#endif
#ifdef E4PARM_LOW
if ( c4 == 0 )
return error4( 0, e4parm_null, E96101 ) ;
#endif
if ( c4->defaultServer == 0 )
return error4( c4, e4connection, E84302 ) ;
#ifdef E4ANALYZE
if ( c4->defaultServer->connect == 0 )
return error4( c4, e4parm, E96101 ) ;
#endif
connection = c4->defaultServer->connect ;
connection4assign( connection, CON4INFO, 0L, 0L ) ;
connection4send( connection ) ;
rc = connection4receive( connection ) ;
if ( rc < 0 )
return error4stack( c4, rc, E96101 ) ;
rc = connection4status( connection ) ;
if ( rc < 0 )
return connection4error( connection, c4, rc, E96101 ) ;
if ( connection4len( connection ) < sizeof( CONNECTION4SERVER_INFO_OUT ) )
return error4( c4, e4packetLen, E96101 ) ;
#ifdef S4CONSOLE
out = (CONNECTION4SERVER_INFO_OUT *)connection4data( connection ) ;
printf( "\nSERVER STATS\n------------\n" ) ;
if ( out->memMax == -1 )
printf( "memMax: unknown\n" ) ;
else
printf( "memMax: %ld\n", out->memMax ) ;
if ( out->memAlloc == -1 )
printf( "memAlloc: unknown\n" ) ;
else
printf( "memAlloc: %ld\n", out->memAlloc ) ;
printf( "numRequests: %ld\n", out->numRequests ) ;
printf( "numClients: %d\n", out->numClients ) ;
printf( "elapsedSeconds: %ld\n", (long)out->elapsedSeconds ) ;
if ( connection4len( connection ) != (long)(sizeof( CONNECTION4SERVER_INFO_OUT ) + out->numClients * sizeof( CONNECTION4CLIENT_INFO )) )
return error4( c4, e4packetLen, E96101 ) ;
printf( "\nCLIENT STATS\n------------\n" ) ;
for ( i = 0 ; i < out->numClients ; i++ )
{
client = (CONNECTION4CLIENT_INFO *)(((char *)out) + sizeof( CONNECTION4SERVER_INFO_OUT ) + i * sizeof( CONNECTION4CLIENT_INFO ) ) ;
/* printf( Client Name... */
printf( "numData: %d\n", client->numData ) ;
printf( "numRelate: %d\n", client->numRelate ) ;
printf( "numRequests: %ld\n", client->numRequests ) ;
printf( "numTransactions: %d\n", client->numTransactions ) ;
printf( "numCompletedTransactions: %d\n", client->numCompletedTransactions ) ;
printf( "numRollbacks: %d\n", client->numRollbacks ) ;
printf( "elapsedSeconds: %ld\n", (long)client->elapsedSeconds ) ;
printf( "activeTransaction: %d\n", client->activeTransaction ) ;
}
printf( "-----------------------------------\n\n" ) ;
#endif
return 0 ;
}
#endif