Review Request: KMemoryInfo: system memory query
Pino Toscano
pino at kde.org
Sun Jan 10 19:44:41 GMT 2010
> On 2010-01-10 04:05:34, John Tapsell wrote:
> > At a quick glance, it looks like you're returning the values in bytes?
> > The documentation doesn't say what the units are anywhere.
> >
> > I think returning the values in kilobytes is better.
> >
> > For the linux implementation you use the sysinfo function. Any idea
> > how this compares, speed wise, to sysconf?
> >
> > E.g. doing:
> > return ((long long)sysconf(_SC_PHYS_PAGES)) * (sysconf(_SC_PAGESIZE)/1024);
> >
> > etc. This also avoids the need for an update()
> >
> >
Yes, the units are bytes, I'll point that in the apidox. I chose bytes to leave more flexibility to users, which can just divide by 1024 (or RHS by 10).
I did not compare sysconf() with sysinfo(), actually; in case, the Linux implementation can be changed/improved later.
- Pino
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2536/#review3621
-----------------------------------------------------------
On 2010-01-09 23:18:46, Pino Toscano wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2536/
> -----------------------------------------------------------
>
> (Updated 2010-01-09 23:18:46)
>
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> KMemoryInfo is a small class used to query the OS requesting the memory (RAM) information available.
> It is possible to selectively choose which information request.
> The implementations provided so far are for Linux and Windows; more OSes can easily be added later.
> The (so far small) unit test should help assuring the implementation for the current OS is sane.
>
> Possible users interested by this: okular and gwenview (which currently have basically the same code), and maybe ksysguard/processcore, superkaramba, kio_sysinfo, and kinfocenter (once KMemoryInfo reaches the number of OS implementation kinfocenter has).
>
>
> Diffs
> -----
>
> /trunk/KDE/kdelibs/kdecore/CMakeLists.txt 1072277
> /trunk/KDE/kdelibs/kdecore/tests/CMakeLists.txt 1072277
> /trunk/KDE/kdelibs/kdecore/tests/kmemoryinfotest.cpp PRE-CREATION
> /trunk/KDE/kdelibs/kdecore/util/kmemoryinfo.h PRE-CREATION
> /trunk/KDE/kdelibs/kdecore/util/kmemoryinfo.cpp PRE-CREATION
> /trunk/KDE/kdelibs/kdecore/util/kmemoryinfo_linux.cpp PRE-CREATION
> /trunk/KDE/kdelibs/kdecore/util/kmemoryinfo_win.cpp PRE-CREATION
>
> Diff: http://reviewboard.kde.org/r/2536/diff
>
>
> Testing
> -------
>
> The small unit test pass, an example application as well.
>
>
> Thanks,
>
> Pino
>
>
More information about the kde-core-devel
mailing list