NetBSD Problem Report #40960

From njoly@lanfeust.sis.pasteur.fr  Wed Mar  4 15:28:27 2009
Return-Path: <njoly@lanfeust.sis.pasteur.fr>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 98CC463BAB8
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  4 Mar 2009 15:28:27 +0000 (UTC)
Message-Id: <20090304152823.DF6B7DC9B9@lanfeust.sis.pasteur.fr>
Date: Wed,  4 Mar 2009 16:28:23 +0100 (CET)
From: njoly@pasteur.fr
Reply-To: njoly@pasteur.fr
To: gnats-bugs@gnats.NetBSD.org
Subject: gprof(1) does not report accumulated time for profiled binaries
X-Send-Pr-Version: 3.95

>Number:         40960
>Category:       port-amd64
>Synopsis:       gprof(1) does not report accumulated time for profiled binaries
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 04 15:30:00 +0000 2009
>Closed-Date:    Sat Nov 14 13:27:05 +0000 2009
>Last-Modified:  Sat Nov 14 13:27:05 +0000 2009
>Originator:     Nicolas Joly
>Release:        NetBSD 5.99.7
>Organization:
Institut Pasteur
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 5.99.7 NetBSD 5.99.7 (LANFEUST) #0: Tue Mar 3 12:23:05 CET 2009 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
gprof(1) does not report accumulated time for profiled binaries on amd64 (i
checked that it works fine on i386 and alpha).

njoly@lanfeust [tmp/gprof]> cat prof.c 
#include <err.h>
#include <stdlib.h>
#include <string.h>

int main() {
  char *buf;
  int i, cnt;
  size_t len;

  cnt = 10000;
  len = 1 * 1024 * 1024;

  for (i = 0; i < cnt; i++) {
    buf = malloc(len);
    if (buf == NULL)
      err(1, "malloc failed");
    (void)memset(buf, 0xff, len);
    free(buf);
  }

  return 0; }
njoly@lanfeust [tmp/gprof]> cc -pg -o prof prof.c 
njoly@lanfeust [tmp/gprof]> /usr/bin/time ./prof
       16.10 real         4.20 user        11.69 sys
njoly@lanfeust [tmp/gprof]> gprof ./prof ./gmon.out
Flat profile:

Each sample counts as 0.01 seconds.
 no time accumulated

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00   160011     0.00     0.00  __libc_mutex_trylock
  0.00      0.00     0.00    20000     0.00     0.00  base_chunk_node_alloc
  0.00      0.00     0.00    20000     0.00     0.00  chunk_tree_s_RB_INSERT


>How-To-Repeat:
Try the above sequence.
>Fix:
Please.

>Release-Note:

>Audit-Trail:
From: David Laight <dsl@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40960 CVS commit: src/sys/arch/amd64/amd64
Date: Fri, 13 Nov 2009 22:49:47 +0000

 Module Name:	src
 Committed By:	dsl
 Date:		Fri Nov 13 22:49:47 UTC 2009

 Modified Files:
 	src/sys/arch/amd64/amd64: copy.S

 Log Message:
 tlbstate is 'int', so use 'cmpl' not 'cmpq'.
 Fixes gprof on amd64 PR/40960.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/amd64/copy.S

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Sat, 14 Nov 2009 13:27:05 +0000
State-Changed-Why:
Fixed by patch to copy.S


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.