mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Con Kolivas <kernel@kolivas.org>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>,
	ck list <ck@vds.kolivas.org>, Tony Lindgren <tony@atomide.com>,
	Adam Belay <abelay@novell.com>,
	Daniel Petrini <d.pensator@gmail.com>,
	vatsa@in.ibm.com, acpi-devel@lists.sourceforge.net
Subject: Account time spent in C-States [Was: [PATCH] i386 no idle HZ aka Dynticks 051203]
Date: Sun, 4 Dec 2005 13:32:08 +0100	[thread overview]
Message-ID: <20051204123208.GA9817@dominikbrodowski.de> (raw)
In-Reply-To: <200512041737.07996.kernel@kolivas.org>

Keep track of the time actually spent sleeping in C2, C3-type sleep; not
only of the number of invocations of these sleep types. This is especially
useful when using "dynamic ticks" when the number of invocations do not
correlate to length of sleep.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

Index: working-tree/drivers/acpi/processor_idle.c
===================================================================
--- working-tree.orig/drivers/acpi/processor_idle.c
+++ working-tree/drivers/acpi/processor_idle.c
@@ -300,8 +300,6 @@ static void acpi_processor_idle(void)
 		}
 	}
 
-	cx->usage++;
-
 #ifdef CONFIG_HOTPLUG_CPU
 	/*
 	 * Check for P_LVL2_UP flag before entering C2 and above on
@@ -409,6 +407,15 @@ static void acpi_processor_idle(void)
 		local_irq_enable();
 		return;
 	}
+	cx->usage++;
+	if (cx->type != ACPI_STATE_C1) {
+		if (sleep_ticks > 0)
+			cx->time += sleep_ticks;
+	} else {
+		/* for C1, where we don't know the exact value, assume 0.5 of
+		 * a jiffy */
+		cx->time += (PM_TIMER_FREQUENCY / (2 * HZ));
+	}
 
 	next_state = pr->power.state;
 
@@ -1014,9 +1021,10 @@ static int acpi_processor_power_seq_show
 		else
 			seq_puts(seq, "demotion[--] ");
 
-		seq_printf(seq, "latency[%03d] usage[%08d]\n",
+		seq_printf(seq, "latency[%03d] usage[%08d] time[%020llu]\n",
 			   pr->power.states[i].latency,
-			   pr->power.states[i].usage);
+			   pr->power.states[i].usage,
+			   pr->power.states[i].time);
 	}
 
       end:
Index: working-tree/include/acpi/processor.h
===================================================================
--- working-tree.orig/include/acpi/processor.h
+++ working-tree/include/acpi/processor.h
@@ -51,6 +51,7 @@ struct acpi_processor_cx {
 	u32 latency_ticks;
 	u32 power;
 	u32 usage;
+	u64 time;
 	struct acpi_processor_cx_policy promotion;
 	struct acpi_processor_cx_policy demotion;
 };

  parent reply	other threads:[~2005-12-04 12:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04  6:37 [PATCH] i386 no idle HZ aka Dynticks 051203 Con Kolivas
2005-12-04 12:24 ` fix cpufreq-ondemand by accounting skipped ticks as idle ticks [Was: [PATCH] i386 no idle HZ aka Dynticks 051203] Dominik Brodowski
2005-12-04 12:32   ` Con Kolivas
2005-12-05  2:02   ` Con Kolivas
2005-12-04 12:32 ` Dominik Brodowski [this message]
2005-12-04 12:55 ` busmaster and C-States " Dominik Brodowski
2005-12-04 13:01 ` C-State policy and dynticks " Dominik Brodowski
2005-12-04 14:33 ` Dyntick effectiveness " Dominik Brodowski

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=20051204123208.GA9817@dominikbrodowski.de \
    --to=linux@dominikbrodowski.net \
    --cc=abelay@novell.com \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=ck@vds.kolivas.org \
    --cc=d.pensator@gmail.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=vatsa@in.ibm.com \
    /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

all inboxes | Powered by JetHome®