All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kir Kolyshkin <kir-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Cc: Linux Containers
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Balbir Singh
	<balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [Devel] [PATCH 2/3] Introduce the res_counter_populate() function
Date: Thu, 04 Oct 2007 16:11:57 +0400	[thread overview]
Message-ID: <4704D88D.1010005@openvz.org> (raw)
In-Reply-To: <4704B077.30502-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>

Pavel Emelyanov wrote:
> <...skipped...>
> +static char * units_names[RES_UNITS_MAX][RES_CFT_MAX] = {
> +	[RES_UNITS_BYTES] = {
> +		"usage_in_bytes",
> +		"limit_in_bytes",
> +		"failcnt",
> +	},
> +	[RES_UNITS_ITEMS] = {
> +		"usage",
> +		"limit",
> +		"failcnt",
> +	},
> +};
>   

Sorry for being late in the game, but can we please bring back the issue 
of naming those files?

To me, names like "usage_in_bytes" doesn't really make much sense, 
unless we will also have something like "usage_in_pages" next to it -- 
i.e. use several different units for the same resource. I seriously 
doubt we should...

Still, we need a way to denote units of measurement for each resource. 
Here are the options I can think of:

0. Hardcode the name of measurement units in file name, as it is 
(partially -- only for "bytes" done now). Looks ugly to me, access 
interface will be inconsistent, not program-friendly: as file name is 
not "usage", but "usage*", it will be easy to implement in shell, but 
requires some additional logic in C.

1. One obvious way is to put it in documentation, i.e. say something 
like "this parameter is measured in bytes". The problem is documentation 
is a bit far away from the actual file we read the value from.

2. Put units into the file itself, i.e. "cat usage" will print something 
like "1024 bytes". This is very user-friendly, but not really 
program-friendly: while in C it is just fscanf(fd, "%d", &val), shell 
users will require something like "cut -d ' ' -f1" to extract the 
numeric value.

3. Put units into a separate new files named "units" (or, well, 
"measurement_units" (or even "measured_in") if you are fan of long 
descriptive names). So, "cat units" will show us "bytes" or "items" or 
"pages"...

4. Encode units into a file name, like "measured_in_bytes". This would 
be a separate file which exist just for the sake of the name. This looks 
bad to be since getting this info from a program is complex.

I prefer approach #3 -- easy and consistent.
> <...skipped...>
>   

  parent reply	other threads:[~2007-10-04 12:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04  9:18 [PATCH 0/3] Consolidate cgroup files creation for resource counters (v2) Pavel Emelyanov
     [not found] ` <4704AFC9.4030606-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-10-04  9:18   ` [PATCH 1/3] Typedefs the read and write functions in cftype Pavel Emelyanov
     [not found]     ` <4704AFFF.4000000-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-10-04 15:18       ` Paul Menage
2007-10-04  9:20   ` [PATCH 2/3] Introduce the res_counter_populate() function Pavel Emelyanov
     [not found]     ` <4704B077.30502-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-10-04 12:11       ` Kir Kolyshkin [this message]
     [not found]         ` <4704D88D.1010005-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-10-04 15:01           ` [Devel] " Paul Menage
2007-10-04 15:22       ` Paul Menage
2007-10-04  9:21   ` [PATCH 3/3] Use the res_counter_populate in memory controller Pavel Emelyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4704D88D.1010005@openvz.org \
    --to=kir-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.