about summary refs log tree commit diff
path: root/gmon
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-12-19 12:11:38 +0000
committerJakub Jelinek <jakub@redhat.com>2005-12-19 12:11:38 +0000
commit2c6cfe6853a30deb4af842aacc924fa298d0521a (patch)
tree7fcc409e499bb8e3d96522f7fc2393fc10e53db2 /gmon
parent3ccb96cd41b38d0159bdf8aad229c3599864c65d (diff)
downloadglibc-2c6cfe6853a30deb4af842aacc924fa298d0521a.tar.gz
glibc-2c6cfe6853a30deb4af842aacc924fa298d0521a.tar.xz
glibc-2c6cfe6853a30deb4af842aacc924fa298d0521a.zip
Updated to fedora-glibc-20051219T1003 cvs/fedora-glibc-2_3_90-19
Diffstat (limited to 'gmon')
-rw-r--r--gmon/bb_init_func.c54
-rw-r--r--gmon/prof-freq.c55
-rw-r--r--gmon/profil.c42
-rw-r--r--gmon/sprofil.c36
4 files changed, 187 insertions, 0 deletions
diff --git a/gmon/bb_init_func.c b/gmon/bb_init_func.c
new file mode 100644
index 0000000000..19901d8d09
--- /dev/null
+++ b/gmon/bb_init_func.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* __bb_init_func is invoked at the beginning of each function, before
+   any registers have been saved.  This generic routine should work
+   provided that calling this function doesn't mangle the arguments
+   passed to the function being called.  If that's not the case, a
+   system specific routine must be provided.  */
+
+#include <sys/types.h>
+#include <sys/gmon.h>
+
+#include <stdlib.h>
+
+void
+__bb_init_func (struct __bb *bb)
+{
+  struct gmonparam *p = &_gmonparam;
+
+  if (bb->zero_word != 0)
+    {
+      return;	/* handle common case quickly */
+    }
+
+  /* insert this basic-block into basic-block list: */
+  bb->zero_word = 1;
+  bb->next = __bb_head;
+  __bb_head = bb;
+
+  if (bb->next == 0 && p->state != GMON_PROF_ON)
+    {
+      /* we didn't register _mcleanup yet and pc profiling doesn't seem
+	 to be active, so let's register it now: */
+      extern void *__dso_handle __attribute__ ((__weak__));
+      __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
+		    &__dso_handle ? __dso_handle : NULL);
+    }
+}
diff --git a/gmon/prof-freq.c b/gmon/prof-freq.c
new file mode 100644
index 0000000000..ffcc67931b
--- /dev/null
+++ b/gmon/prof-freq.c
@@ -0,0 +1,55 @@
+/* Return frequency of ticks reported by profil.  Generic version. */
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <libc-internal.h>
+
+int
+__profile_frequency (void)
+{
+  /*
+   * Discover the tick frequency of the machine if something goes wrong,
+   * we return 0, an impossible hertz.
+   */
+  struct itimerval tim;
+
+  tim.it_interval.tv_sec = 0;
+  tim.it_interval.tv_usec = 1;
+  tim.it_value.tv_sec = 0;
+  tim.it_value.tv_usec = 0;
+  __setitimer(ITIMER_REAL, &tim, 0);
+  __setitimer(ITIMER_REAL, 0, &tim);
+  if (tim.it_interval.tv_usec < 2)
+    return 0;
+  return (1000000 / tim.it_interval.tv_usec);
+}
+libc_hidden_def (__profile_frequency)
diff --git a/gmon/profil.c b/gmon/profil.c
new file mode 100644
index 0000000000..8736375858
--- /dev/null
+++ b/gmon/profil.c
@@ -0,0 +1,42 @@
+/* Low-level statistical profiling support function.  Stub version.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* Enable statistical profiling, writing samples of the PC into at most
+   SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
+   is enabled, the system examines the user PC and increments
+   SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
+   disable profiling.  Returns zero on success, -1 on error.  */
+
+int
+__profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
+{
+  if (scale == 0)
+    /* Disable profiling.  */
+    return 0;
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__profil, profil)
+stub_warning (profil)
+#include <stub-tag.h>
diff --git a/gmon/sprofil.c b/gmon/sprofil.c
new file mode 100644
index 0000000000..037ed4672e
--- /dev/null
+++ b/gmon/sprofil.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+
+#include <sys/profil.h>
+#include <sys/time.h>
+
+int
+__sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
+	   unsigned int flags)
+{
+  if (profcnt == 0)
+    return 0;
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__sprofil, sprofil)