Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 14 Jan 2003 17:00:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 14 Jan 2003 17:00:33 -0500 Received: from mailout03.sul.t-online.com ([194.25.134.81]:59852 "EHLO mailout03.sul.t-online.com") by vger.kernel.org with ESMTP id ; Tue, 14 Jan 2003 17:00:31 -0500 Cc: linux-kernel@vger.kernel.org References: From: Olaf Dietsche To: Maciej Soltysiak Subject: Re: timing an application Date: Tue, 14 Jan 2003 23:09:16 +0100 Message-ID: <87vg0rjsdv.fsf@goat.bogus.local> Lines: 20 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) XEmacs/21.4 (Military Intelligence, i386-debian-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Maciej Soltysiak writes: > being inspired by some book about optimizing c++ code i decided to do > timing of functions i wrote. I am using gettimeofday to set > two timeval structs and calculate the time between them. > But the results depend heavily on the load, also i reckon that this > is an innacurate timing. You will get elapsed time, which is usually not the same as used cpu time. > Any ideas on timing a function, or a block of code? Maybe some kernel > timers or something. If you're timing/pofiling some user space functions, gprof should be sufficient. If you want to profile kernel and module functions as well, try oprofile at . It is part of the kernel since 2.5.43. Regards, Olaf. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/