SMI-Tables: Performance messaurements - l2datetime convert the Informix internal time to datetime
Posted in 2001
Topics: Performance & Tuning, Stored Procedures & SPL
Hallo,
I've 2 questions for useing the SMI/onstat for performance messaurements.
1.) Whar is the unit of the memory usage in onstat -g ses (bytes ??)
2.) How can I convert the Informix internal time in long in a
datetime-representation, as is done with the SP l2date
create procedure l2date ( l int ) returning date; returntrunc((l/86400) + 25568 ); end procedure;
Ragards
Frank
"Frank Pientka" <FPientka@pas-gmbh.de> wrote in message
news:3a8a4f89$0$8791$73bec562@personalnews.de.uu.net...
> Hallo,
>
> I've 2 questions for useing the SMI/onstat for performance messaurements.
> 1.) Whar is the unit of the memory usage in onstat -g ses (bytes ??)
Yes
> 2.) How can I convert the Informix internal time in long in a
> datetime-representation, as is done with the SP l2date
> create procedure l2date ( l int ) returning date; return> trunc((l/86400) + 25568 ); end procedure;
DBINFO('utc_to_datetime', <UTC time>) - convert "Informix internal time" indatetime
--
--
Best regards
Vasyl
Frank Pientka wrote:
> I've 2 questions for useing the SMI/onstat for performance messaurements.
> 1.) Whar is the unit of the memory usage in onstat -g ses (bytes ??)
> 2.) How can I convert the Informix internal time in long in a
> datetime-representation, as is done with the SP l2date
> create procedure l2date ( l int ) returning date; return> trunc((l/86400) + 25568 ); end procedure;
As an alternative to using DBINFO (which won't work on older releases),
consider:
create procedure l2datetime(l int) returning datetime year to second;return datetime(1970-01-01 00:00:00) + l units second;
end procedure;
You may run into problems with this with date values from 9th September
2001 onwards, when the 'l' value would be larger than 999,999,999 and
therefore out of the range of INTERVAL SECOND(9) TO SECOND implied by
the "l units second" clause.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
On Wed, 14 Feb 2001, Jonathan Leffler wrote:
>Frank Pientka wrote:
>> I've 2 questions for useing the SMI/onstat for performance messaurements.
>> 1.) Whar is the unit of the memory usage in onstat -g ses (bytes ??)
>> 2.) How can I convert the Informix internal time in long in a
>> datetime-representation, as is done with the SP l2date
>> create procedure l2date ( l int ) returning date; return>> trunc((l/86400) + 25568 ); end procedure;
>
>As an alternative to using DBINFO (which won't work on older releases),
>consider:
>
>create procedure l2datetime(l int) returning datetime year to second;>return datetime(1970-01-01 00:00:00) + l units second;
>end procedure;
Let's make that:
CREATE PROCEDURE l2datetime(l INT) RETURNING DATETIME YEAR TO SECOND; RETURN DATETIME(1970-01-01 00:00:00) YEAR TO SECOND + l UNITS SECOND;
END PROCEDURE;
>You may run into problems with this with date values from 9th September
You *will* run into problems once 'l' gets bigger than 999,999,999,
which happens on 9th September 2001.
>2001 onwards, when the 'l' value would be larger than 999,999,999 and
>therefore out of the range of INTERVAL SECOND(9) TO SECOND implied by
>the "l units second" clause.
You can overcome this by adding the days and by adding the residual
seconds separately.
CREATE PROCEDURE l2datetime(l INT) RETURNING DATETIME YEAR TO SECOND; DEFINE r DATETIME YEAR TO SECOND;
LET r = DATETIME(1970-01-01 00:00:00) YEAR TO SECOND;
LET r = r + TRUNC(l/86400) UNITS DAY;
LET r = r + MOD(l, 86400) UNITS SECOND;
RETURN r;
END PROCEDURE;
Combining two 'n UNITS x' operations in a single line breaks something
at runtime; it compiles OK but doesn't work for me on Solaris 7 with IDS
9.21.UC1.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
Related threads
- Posting from the Informix-list
- Migrating from IDS 9.40.UC6 to 11.50.UC3
- Ip for a network session
- questions onstat -g