Floyd Wellershaus wrote:
> Hi,
> Does anyone know which table in sysmaster or some other easy way to
> get the number of seconds an instance has been up ?
> The onstat commands give you the answer in number of days plus hours
> etc...
> I'd like to find a table where that data exists, and then I can do a
> datetime function on it to determine the number of seconds, so that I
> can get that value into a script easily.
The sh_boottime field in sysmaster:sysshmvals is the epoch when the
server was started, sh_pfclrtime is the epoch when the server stats were
last zerod (onstat -z), and sh_curtime is the current epoch. So the #
seconds since the server started is:
SELECT sh_curtime - sh_boottime FROM sysshmvals;
For example, below is from my laptop's server:
C:\\Users\\art>dbaccess sysmaster -
Database selected.
> select * from sysshmvals;
sh_mode 5
sh_boottime 1205858585
sh_pfclrtime 1206235200
sh_curtime 1206658008
sh_bootstamp 0
sh_stamp 601484
sh_mainlooptcb 252025656
sh_sysflags 4097
sh_maxchunks 32766
sh_maxdbspaces 2047
sh_maxuserthreads 32767
sh_maxtrans 32767
sh_maxlocks 20000
sh_maxlogs 6
sh_nbuffs 10000
sh_pagesize 4096
sh_nlrus 16
sh_maxdirty 60.00000000000
sh_mindirty 50.00000000000
sh_ncleaners 8
sh_longtx 0
sh_optstgbsnum 0
sh_cpflag 0
sh_rapages 64
sh_rathreshold 16
sh_lastlogfreed 7
sh_rmdlktout 60
sh_narchivers 0
sh_maxpdqpriority 0
sh_curmaxcons 2
sh_ovlmaxcons 2
1 row(s) retrieved.
>
1206658008 - 1205858585 = 799794
799794 / 86400 = 9 days
799794 % 86400 = 22194 seconds since midnight
22194 / 3600 = 6 hours
22194 % 3600 = 594 seconds since the hour
594 / 60 = 9 minutes
594 % 60 = 54
And shortly after taht onstat - reported:
IBM Informix Dynamic Server Version 11.50.TCB3TL -- On-Line -- Up 9
days 06:10:17 -- 78208 Kbytes
Art S. Kagel
Oninit
>
> Thanks,
> Floyd
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>