From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 14 20:31:23 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D25D916A41B for ; Thu, 14 Feb 2008 20:31:23 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 9442813C45E for ; Thu, 14 Feb 2008 20:31:23 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 29FA474400B for ; Thu, 14 Feb 2008 22:31:22 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10027) with ESMTP id LJjNEo7C7GLq for ; Thu, 14 Feb 2008 22:31:22 +0200 (EET) Received: from [10.74.70.239] (unknown [193.138.145.53]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 9C09974400A for ; Thu, 14 Feb 2008 22:31:21 +0200 (EET) Message-ID: <47B4A514.1020103@icyb.net.ua> Date: Thu, 14 Feb 2008 22:31:16 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20071208) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: cpu stats and another interrupt question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2008 20:31:23 -0000 Dear hackers, I'd like to check with you if my understanding of some code is correct. If we speak about a typical older i386 system, with UP and "AT" PIC, I think this is how the CPU utilization stats are collected. RTC is configured to generate interrupts (IRQ8) 128 times per second. Each time interrupt is generated RTC interrupt handler (I will use simple non technical terms) takes a peek at what was interrupted and depending on the properties of that thing (kernel thread) bills a tick to particular category. E.g. if it sees that the "idle" thread is interrupted then a tick is billed to "idle", if an interrupt thread is interrupted (software or hardware) then a tick is billed to interrupt, if a thread is running user-mode code then a tick is billed to "user" or "nice", otherwise it's "system". I understand that I oversimplify, but is the above correct in general ? Another, unrelated, question. Considering this snippet from sys/i386/isa/atpic.c, i8259_init(): #ifndef PC98 /* OCW2_L1 sets priority order to 3-7, 0-2 (com2 first). */ if (!slave) outb(pic->at_ioaddr, OCW2_R | OCW2_SL | OCW2_L1); #endif Do I understand correctly the code and the comment that here we use a feature of 8259 PIC that can be called "cyclic shift of interrupt priorities" ? So, we really have the following order of interrupts, from higher priority to lower: 3-7,0,1,8-15? Considering two chained 8259s, of course. -- Andriy Gapon