From: Ming Lei on 9 Jul 2010 03:10 2010/7/9 Arjan van de Ven <arjan(a)infradead.org>: > From: Arjan van de Ven <arjan(a)linux.intel.com> > diff --git a/include/linux/pm.h b/include/linux/pm.h > index 8e258c7..dca597f 100644 > --- a/include/linux/pm.h > +++ b/include/linux/pm.h > @@ -476,9 +476,15 @@ struct dev_pm_info { > � � � �enum rpm_request � � � �request; > � � � �enum rpm_status � � � � runtime_status; > � � � �int � � � � � � � � � � runtime_error; > + � � � unsigned long � � � � � active_jiffies; > + � � � unsigned long � � � � � suspended_jiffies; > + � � � unsigned long � � � � � accounting_timestamp; > �#endif > �}; USB subsystem has implemented the function already, and only two variables are enough to do the statistics. Suggest you to make a reference to usb implementation, maybe sizeof(unsigned long) bytes per device can be saved. -- Lei Ming -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Arjan van de Ven on 9 Jul 2010 07:20 On Fri, 9 Jul 2010 15:04:59 +0800 Ming Lei <tom.leiming(a)gmail.com> wrote: > 2010/7/9 Arjan van de Ven <arjan(a)infradead.org>: > > From: Arjan van de Ven <arjan(a)linux.intel.com> > > diff --git a/include/linux/pm.h b/include/linux/pm.h > > index 8e258c7..dca597f 100644 > > --- a/include/linux/pm.h > > +++ b/include/linux/pm.h > > @@ -476,9 +476,15 @@ struct dev_pm_info { > > enum rpm_request request; > > enum rpm_status runtime_status; > > int runtime_error; > > + unsigned long active_jiffies; > > + unsigned long suspended_jiffies; > > + unsigned long accounting_timestamp; > > #endif > > }; > > USB subsystem has implemented the function already, and only two > variables are enough to do the statistics. Suggest you to make a > reference to usb implementation, maybe sizeof(unsigned long) bytes > per device can be saved. > I did look at the USB implementation, and it is very clever. But it's more complex at the same time, because you no longer can just read out the time stamps, you need to look at the current device state each time to either subtract jiffies or not. by having the timestamp as a separate variable all the code gets a lot simpler..... sometimes simple over clever is the right thing to do. -- Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH] vmscan: protect to read reclaim_stat by lru_lock Next: netfilter: add CHECKSUM target |