Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* Simple system stats.
@ 2019-11-02 11:51 Andre Schmidt
  2019-11-02 12:07 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Andre Schmidt @ 2019-11-02 11:51 UTC (permalink / raw)
  To: kernelnewbies

Hello kernel space,

user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P

The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat).

But i could not get swap info in the kernel module, cause - i guess - it's not exported?
So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)?
If yes/maybe, where/how should i propose such change?

Cheers
Andre Schmidt

* "created" as in i copy and pasted from upstream code...

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Simple system stats.
  2019-11-02 11:51 Simple system stats Andre Schmidt
@ 2019-11-02 12:07 ` Greg KH
  2019-11-02 13:05   ` Andre Schmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-11-02 12:07 UTC (permalink / raw)
  To: Andre Schmidt; +Cc: kernelnewbies

On Sat, Nov 02, 2019 at 12:51:05PM +0100, Andre Schmidt wrote:
> Hello kernel space,
> 
> user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P
> 
> The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat).
> 
> But i could not get swap info in the kernel module, cause - i guess - it's not exported?
> So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)?
> If yes/maybe, where/how should i propose such change?

Symbols and functions are only exported if an in-kernel-tree module
needs it.  Sorry.

What's wrong with parsing the existing exports of this value as-is?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Simple system stats.
  2019-11-02 12:07 ` Greg KH
@ 2019-11-02 13:05   ` Andre Schmidt
  2019-11-02 13:13     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Andre Schmidt @ 2019-11-02 13:05 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Sat, 2 Nov 2019 13:07:00 +0100
Greg KH <greg@kroah.com> wrote:

> On Sat, Nov 02, 2019 at 12:51:05PM +0100, Andre Schmidt wrote:
> > Hello kernel space,
> > 
> > user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P
> > 
> > The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat).
> > 
> > But i could not get swap info in the kernel module, cause - i guess - it's not exported?
> > So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)?
> > If yes/maybe, where/how should i propose such change?
>
> Symbols and functions are only exported if an in-kernel-tree module
> needs it.  Sorry.
>
> What's wrong with parsing the existing exports of this value as-is?

do you mean i can get swap usage info in a kernel module without si_swapinfo?
(as seen here https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/proc/meminfo.c#n44)

or do you mean what is wrong with /proc/meminfo?

Cheers
Andre Schmidt

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Simple system stats.
  2019-11-02 13:05   ` Andre Schmidt
@ 2019-11-02 13:13     ` Greg KH
  2019-11-02 13:56       ` Andre Schmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-11-02 13:13 UTC (permalink / raw)
  To: Andre Schmidt; +Cc: kernelnewbies

On Sat, Nov 02, 2019 at 02:05:19PM +0100, Andre Schmidt wrote:
> On Sat, 2 Nov 2019 13:07:00 +0100
> Greg KH <greg@kroah.com> wrote:
> 
> > On Sat, Nov 02, 2019 at 12:51:05PM +0100, Andre Schmidt wrote:
> > > Hello kernel space,
> > > 
> > > user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P
> > > 
> > > The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat).
> > > 
> > > But i could not get swap info in the kernel module, cause - i guess - it's not exported?
> > > So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)?
> > > If yes/maybe, where/how should i propose such change?
> >
> > Symbols and functions are only exported if an in-kernel-tree module
> > needs it.  Sorry.
> >
> > What's wrong with parsing the existing exports of this value as-is?
> 
> do you mean i can get swap usage info in a kernel module without si_swapinfo?

Not that I know of, no.

> (as seen here https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/proc/meminfo.c#n44)
> 
> or do you mean what is wrong with /proc/meminfo?

Yes, what is wrong with that?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Simple system stats.
  2019-11-02 13:13     ` Greg KH
@ 2019-11-02 13:56       ` Andre Schmidt
  0 siblings, 0 replies; 5+ messages in thread
From: Andre Schmidt @ 2019-11-02 13:56 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Sat, 2 Nov 2019 14:13:08 +0100
Greg KH <greg@kroah.com> wrote:

> On Sat, Nov 02, 2019 at 02:05:19PM +0100, Andre Schmidt wrote:
> > On Sat, 2 Nov 2019 13:07:00 +0100
> > Greg KH <greg@kroah.com> wrote:
> > 
> > > On Sat, Nov 02, 2019 at 12:51:05PM +0100, Andre Schmidt wrote:
> > > > Hello kernel space,
> > > > 
> > > > user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P
> > > > 
> > > > The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat).
> > > > 
> > > > But i could not get swap info in the kernel module, cause - i guess - it's not exported?
> > > > So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)?
> > > > If yes/maybe, where/how should i propose such change?
> > >
> > > Symbols and functions are only exported if an in-kernel-tree module
> > > needs it.  Sorry.
> > >
> > > What's wrong with parsing the existing exports of this value as-is?
> > 
> > do you mean i can get swap usage info in a kernel module without si_swapinfo?
> 
> Not that I know of, no.
> 
> > (as seen here https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/proc/meminfo.c#n44)
> > 
> > or do you mean what is wrong with /proc/meminfo?
> 
> Yes, what is wrong with that?

I guess there's nothing "wrong" with /proc/meminfo (or /proc/stat), i just want to display their - for me/user relevant - data every 250ms and parsing them felt so sub-optimal... So i just removed what i didn't need and pre-calculated what i could, in the kernel module. So i would not need to worry about it again (except, yeah, when upstream changes).

Also, as i dabble in various programming languages (in userspace), i would need to re-implement the parsing and calculation (that matters to me/user) of /proc/stat and /proc/meminfo every time...
(but i guess that is userspace work? translate kernelspace data to userspace data? does "user" even mean "human"?;P)

But whatever, i now like this more:

$> cat /proc/topstat 
cpu 2085949 109734
cpu 2086513 108671
cpu 2086203 110817
cpu 2086167 127600
mem 8026148 2993832 1033648

cpu <total> <used>
- line number implies cpu number.
- <total> jiffies elapsed.
- <used> amount of <total> in use by programs, that cannot be used by other programs.

mem <total> <used> <cached>
- <total> kilobytes of memory.
- <used> amount of <total> in use by programs, that can not be used by other programs.
- <cached> amount of <used> in use for caches, that can be freed by user.

For now, i can live without swap ui, i avoid swap anyway :D

Cheers
Andre Schmidt

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-02 11:51 Simple system stats Andre Schmidt
2019-11-02 12:07 ` Greg KH
2019-11-02 13:05   ` Andre Schmidt
2019-11-02 13:13     ` Greg KH
2019-11-02 13:56       ` Andre Schmidt

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git