From: Kingsley Cheung <kingsley@aurema.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: trivial@rustcorp.com.au
Subject: Re: [Bug 764] New: btime in /proc/stat wobbles (even over 30 seconds)
Date: Fri, 6 Jun 2003 12:26:53 +1000 [thread overview]
Message-ID: <20030606122653.B29095@aurema.com> (raw)
In-Reply-To: <20030605171915.A29095@aurema.com>; from kingsley@aurema.com on Thu, Jun 05, 2003 at 05:19:15PM +1000
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
On Thu, Jun 05, 2003 at 05:19:15PM +1000, Kingsley Cheung wrote:
> I raised this earlier in March this year. See:
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=104804927502272&w=2
>
> I sent to Rusty trivial patch for the fix against 2.4.20 back then.
>
Attached is a trivial patch to fix the problem against 2.5.70. I've
also attached the trivial 2.4.20 patch I sent to Rusty back for
completeness.
--
Kingsley
[-- Attachment #2: proc_misc-2.5.70.patch --]
[-- Type: text/plain, Size: 1474 bytes --]
--- linux/fs/proc/proc_misc.c.orig Fri Jun 6 12:13:44 2003
+++ linux/fs/proc/proc_misc.c Fri Jun 6 12:14:46 2003
@@ -51,6 +51,9 @@
#include <asm/tlb.h>
#include <asm/div64.h>
+/* System boot time in seconds since the UNIX epoch. */
+static time_t boottime;
+
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
/*
@@ -378,7 +381,6 @@
{
int i, len;
extern unsigned long total_forks;
- u64 jif = get_jiffies_64() - INITIAL_JIFFIES;
unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0;
for (i = 0 ; i < NR_CPUS; i++) {
@@ -419,15 +421,14 @@
len += sprintf(page + len, " %u", kstat_irqs(i));
#endif
- do_div(jif, HZ);
len += sprintf(page + len,
"\nctxt %lu\n"
- "btime %lu\n"
+ "btime %ld\n"
"processes %lu\n"
"procs_running %lu\n"
"procs_blocked %lu\n",
nr_context_switches(),
- xtime.tv_sec - (unsigned long) jif,
+ boottime,
total_forks,
nr_running(),
nr_iowait());
@@ -612,6 +613,7 @@
void __init proc_misc_init(void)
{
+ u64 jif = get_jiffies_64() - INITIAL_JIFFIES;
struct proc_dir_entry *entry;
static struct {
char *name;
@@ -638,6 +640,10 @@
{"execdomains", execdomains_read_proc},
{NULL,}
};
+
+ /* Intialise system boot time before creating /proc/stat entry. */
+ do_div(jif, HZ);
+ boottime = xtime.tv_sec - (time_t)jif;
for (p = simple_ones; p->name; p++)
create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
[-- Attachment #3: proc_misc-2.4.20.patch --]
[-- Type: text/plain, Size: 963 bytes --]
--- linux-2.4.20/fs/proc/proc_misc.c Fri Mar 28 15:53:52 2003
+++ linux-2.4.20_boottime/fs/proc/proc_misc.c Fri Mar 28 15:34:21 2003
@@ -41,6 +41,9 @@
#include <asm/pgtable.h>
#include <asm/io.h>
+/* System boot time in seconds since the UNIX epoch. */
+static time_t boottime;
+
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
/*
@@ -372,10 +375,10 @@
proc_sprintf(page, &off, &len,
"\nctxt %u\n"
- "btime %lu\n"
+ "btime %ld\n"
"processes %lu\n",
kstat.context_swtch,
- xtime.tv_sec - jif / HZ,
+ boottime,
total_forks);
return proc_calc_metrics(page, start, off, count, eof, len);
@@ -580,6 +583,9 @@
{"execdomains", execdomains_read_proc},
{NULL,}
};
+
+ /* Intialise system boot time before creating /proc/stat entry. */
+ boottime = xtime.tv_sec - jiffies / HZ;
for (p = simple_ones; p->name; p++)
create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
next prev parent reply other threads:[~2003-06-06 2:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-02 15:02 [Bug 764] New: btime in /proc/stat wobbles (even over 30 seconds) Martin J. Bligh
2003-06-02 15:08 ` Mike Dresser
2003-06-05 7:19 ` Kingsley Cheung
2003-06-06 2:26 ` Kingsley Cheung [this message]
2003-06-06 8:32 ` Herbert Xu
2003-06-06 12:08 ` Kingsley Cheung
2003-06-12 1:20 ` Kingsley Cheung
2003-06-21 0:34 ` john stultz
2003-06-25 23:47 ` Kingsley Cheung
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=20030606122653.B29095@aurema.com \
--to=kingsley@aurema.com \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@rustcorp.com.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox