From: Rick Jones on
k.szczesny(a)gmail.com wrote:
> Rick Jones wrote:
>> moi <root(a)localhost.localdomain> wrote:
>> > On Wed, 15 Nov 2006 06:21:12 -0800, k.szczesny wrote:
>> >> struct minfo s_info;
>> >> int ret = sysinfo(s_info);
>> >>
>>
>> > You'll at least need an & here.
>>
>> > Sysinfo is a linux-extension. Maybe you should try getrusage()
>> > getrlimit(), and friends.
>>
>> Better still (?), peruse the manpage for pstat and start from there :)
>>
>> rick jones

> Thanks for reply,

> it helped a lot, now i've got information about cpu usage, all i have
> left to do is get info about RAM. in pstat there are information about
> virtual memory only as i can see.
> If You could point me into right direction i would be gratefull.

Perhaps some of the "pstat_static" stuff will talk about RAM. Perusal
of the pstat include file(s) might find it. Otherwise, at the risk of
it doing "something else" you could try the latest PD top sources
and/or a tusc (aka system call) trace of top running on an HP-UX
system (or of vmstat or other tools I suppose...)

rick jones
--
a wide gulf separates "what if" from "if only"
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
From: Don Morris on
Rick Jones wrote:
> k.szczesny(a)gmail.com wrote:
>> Rick Jones wrote:
>>> moi <root(a)localhost.localdomain> wrote:
>>>> On Wed, 15 Nov 2006 06:21:12 -0800, k.szczesny wrote:
>>>>> struct minfo s_info;
>>>>> int ret = sysinfo(s_info);
>>>>>
>>>> You'll at least need an & here.
>>>> Sysinfo is a linux-extension. Maybe you should try getrusage()
>>>> getrlimit(), and friends.
>>> Better still (?), peruse the manpage for pstat and start from there :)
>>>
>>> rick jones
>
>> Thanks for reply,
>
>> it helped a lot, now i've got information about cpu usage, all i have
>> left to do is get info about RAM. in pstat there are information about
>> virtual memory only as i can see.
>> If You could point me into right direction i would be gratefull.
>
> Perhaps some of the "pstat_static" stuff will talk about RAM. Perusal
> of the pstat include file(s) might find it. Otherwise, at the risk of
> it doing "something else" you could try the latest PD top sources
> and/or a tusc (aka system call) trace of top running on an HP-UX
> system (or of vmstat or other tools I suppose...)

Yeah -- I tried to point him at pstat() in comp.lang.c, but I guess that
didn't get read.

[Rick, this is directed at k.szczesny -- not at you.. ;) ]
What you want is some combination of pstat_getvminfo(),
pstat_getstatic() and pstat_getdynamic(). Exactly what usage depends
on exactly what you want... read "man 2 pstat" to find out where the
headers live, and check the fields and their descriptions for the
structures filled in by those.

If all you want is total RAM on the machine, and total RAM in
use [by kernel + user + firmware + bad pages, etc.],
physical_memory is in the pst_static structure [total RAM],
and psd_free in the pst_dynamic structure is your free RAM -
both should be in pages, I believe. Per-process RAM usage,
virtual memory consumption, swap and the like will take more
fields/calls.

More arcane machine-dependent things such as CPU types, hardware
bits and the like are best found via the sysconf interface.
"man 2 sysconf"

Take a look -- and feel free to follow up if you have specific
questions.

Don
From: Krystian on

Don Morris wrote:
> Rick Jones wrote:
> > k.szczesny(a)gmail.com wrote:
> >> Rick Jones wrote:
> >>> moi <root(a)localhost.localdomain> wrote:
> >>>> On Wed, 15 Nov 2006 06:21:12 -0800, k.szczesny wrote:
> >>>>> struct minfo s_info;
> >>>>> int ret = sysinfo(s_info);
> >>>>>
> >>>> You'll at least need an & here.
> >>>> Sysinfo is a linux-extension. Maybe you should try getrusage()
> >>>> getrlimit(), and friends.
> >>> Better still (?), peruse the manpage for pstat and start from there :)
> >>>
> >>> rick jones
> >
> >> Thanks for reply,
> >
> >> it helped a lot, now i've got information about cpu usage, all i have
> >> left to do is get info about RAM. in pstat there are information about
> >> virtual memory only as i can see.
> >> If You could point me into right direction i would be gratefull.
> >
> > Perhaps some of the "pstat_static" stuff will talk about RAM. Perusal
> > of the pstat include file(s) might find it. Otherwise, at the risk of
> > it doing "something else" you could try the latest PD top sources
> > and/or a tusc (aka system call) trace of top running on an HP-UX
> > system (or of vmstat or other tools I suppose...)
>
> Yeah -- I tried to point him at pstat() in comp.lang.c, but I guess that
> didn't get read.
>
> [Rick, this is directed at k.szczesny -- not at you.. ;) ]
> What you want is some combination of pstat_getvminfo(),
> pstat_getstatic() and pstat_getdynamic(). Exactly what usage depends
> on exactly what you want... read "man 2 pstat" to find out where the
> headers live, and check the fields and their descriptions for the
> structures filled in by those.
>
> If all you want is total RAM on the machine, and total RAM in
> use [by kernel + user + firmware + bad pages, etc.],
> physical_memory is in the pst_static structure [total RAM],
> and psd_free in the pst_dynamic structure is your free RAM -
> both should be in pages, I believe. Per-process RAM usage,
> virtual memory consumption, swap and the like will take more
> fields/calls.
>
> More arcane machine-dependent things such as CPU types, hardware
> bits and the like are best found via the sysconf interface.
> "man 2 sysconf"
>
> Take a look -- and feel free to follow up if you have specific
> questions.
>
> Don

Thank You Don,

that helped a lot.

My library is done, all i have to do is make it work with java.
On windows there was no problem, but on hp-ux it just can't see the
library, though it's in a directory defined in java.library.path.

Best regards to all,
thank You for help,

Krystian

From: Krystian on

Krystian wrote:
> Don Morris wrote:
> > Rick Jones wrote:
> > > k.szczesny(a)gmail.com wrote:
> > >> Rick Jones wrote:
> > >>> moi <root(a)localhost.localdomain> wrote:
> > >>>> On Wed, 15 Nov 2006 06:21:12 -0800, k.szczesny wrote:
> > >>>>> struct minfo s_info;
> > >>>>> int ret = sysinfo(s_info);
> > >>>>>
> > >>>> You'll at least need an & here.
> > >>>> Sysinfo is a linux-extension. Maybe you should try getrusage()
> > >>>> getrlimit(), and friends.
> > >>> Better still (?), peruse the manpage for pstat and start from there :)
> > >>>
> > >>> rick jones
> > >
> > >> Thanks for reply,
> > >
> > >> it helped a lot, now i've got information about cpu usage, all i have
> > >> left to do is get info about RAM. in pstat there are information about
> > >> virtual memory only as i can see.
> > >> If You could point me into right direction i would be gratefull.
> > >
> > > Perhaps some of the "pstat_static" stuff will talk about RAM. Perusal
> > > of the pstat include file(s) might find it. Otherwise, at the risk of
> > > it doing "something else" you could try the latest PD top sources
> > > and/or a tusc (aka system call) trace of top running on an HP-UX
> > > system (or of vmstat or other tools I suppose...)
> >
> > Yeah -- I tried to point him at pstat() in comp.lang.c, but I guess that
> > didn't get read.
> >
> > [Rick, this is directed at k.szczesny -- not at you.. ;) ]
> > What you want is some combination of pstat_getvminfo(),
> > pstat_getstatic() and pstat_getdynamic(). Exactly what usage depends
> > on exactly what you want... read "man 2 pstat" to find out where the
> > headers live, and check the fields and their descriptions for the
> > structures filled in by those.
> >
> > If all you want is total RAM on the machine, and total RAM in
> > use [by kernel + user + firmware + bad pages, etc.],
> > physical_memory is in the pst_static structure [total RAM],
> > and psd_free in the pst_dynamic structure is your free RAM -
> > both should be in pages, I believe. Per-process RAM usage,
> > virtual memory consumption, swap and the like will take more
> > fields/calls.
> >
> > More arcane machine-dependent things such as CPU types, hardware
> > bits and the like are best found via the sysconf interface.
> > "man 2 sysconf"
> >
> > Take a look -- and feel free to follow up if you have specific
> > questions.
> >
> > Don
>
> Thank You Don,
>
> that helped a lot.
>
> My library is done, all i have to do is make it work with java.
> On windows there was no problem, but on hp-ux it just can't see the
> library, though it's in a directory defined in java.library.path.
>
> Best regards to all,
> thank You for help,
>
> Krystian

It's solved!
Thanks to Gordon Beaton from comp.lang.java.programmer.
He did same example file as I did, and run it with strace /i can't/.
java searches for lib+filename_from_application+.sl file, so i had to
rename my uxinfo.sl to libuxinfo.sl and now it works - well... at least
it loads the library! :)

Best regards, and thanks to all,
Krystian