gmon.c (90668) | gmon.c (93399) |
---|---|
1/*- 2 * Copyright (c) 1983, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if !defined(lint) && defined(LIBC_SCCS) 35static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93"; 36#endif 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1983, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if !defined(lint) && defined(LIBC_SCCS) 35static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93"; 36#endif 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/lib/libc/gmon/gmon.c 90668 2002-02-15 02:37:08Z bde $"); | 38__FBSDID("$FreeBSD: head/lib/libc/gmon/gmon.c 93399 2002-03-29 22:43:43Z markm $"); |
39 40#include "namespace.h" 41#include <sys/param.h> 42#include <sys/time.h> 43#include <sys/gmon.h> 44#include <sys/sysctl.h> 45 | 39 40#include "namespace.h" 41#include <sys/param.h> 42#include <sys/time.h> 43#include <sys/gmon.h> 44#include <sys/sysctl.h> 45 |
46#include "namespace.h" | |
47#include <err.h> | 46#include <err.h> |
48#include "un-namespace.h" 49#include <stdio.h> | |
50#include <fcntl.h> | 47#include <fcntl.h> |
48#include <stdio.h> 49#include <stdlib.h> |
|
51#include <string.h> 52#include <unistd.h> 53#include "un-namespace.h" 54 | 50#include <string.h> 51#include <unistd.h> 52#include "un-namespace.h" 53 |
54#include "libc_private.h" 55 |
|
55#if defined(__ELF__) && (defined(i386) || defined(__sparc64__)) 56extern char *minbrk asm (".minbrk"); 57#else 58extern char *minbrk asm ("minbrk"); 59#endif 60 | 56#if defined(__ELF__) && (defined(i386) || defined(__sparc64__)) 57extern char *minbrk asm (".minbrk"); 58#else 59extern char *minbrk asm ("minbrk"); 60#endif 61 |
61extern char *__progname; 62 | |
63struct gmonparam _gmonparam = { GMON_PROF_OFF }; 64 65static int s_scale; 66/* see profil(2) where this is describe (incorrectly) */ 67#define SCALE_1_TO_1 0x10000L 68 69#define ERR(s) _write(2, s, sizeof(s)) 70 --- 99 unchanged lines hidden (view full) --- 170 } else if (clockinfo.profhz == 0) { 171 if (clockinfo.hz != 0) 172 clockinfo.profhz = clockinfo.hz; 173 else 174 clockinfo.profhz = hertz(); 175 } 176 177 moncontrol(0); | 62struct gmonparam _gmonparam = { GMON_PROF_OFF }; 63 64static int s_scale; 65/* see profil(2) where this is describe (incorrectly) */ 66#define SCALE_1_TO_1 0x10000L 67 68#define ERR(s) _write(2, s, sizeof(s)) 69 --- 99 unchanged lines hidden (view full) --- 169 } else if (clockinfo.profhz == 0) { 170 if (clockinfo.hz != 0) 171 clockinfo.profhz = clockinfo.hz; 172 else 173 clockinfo.profhz = hertz(); 174 } 175 176 moncontrol(0); |
178 snprintf(outname, sizeof(outname), "%s.gmon", __progname); | 177 snprintf(outname, sizeof(outname), "%s.gmon", _getprogname()); |
179 fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666); 180 if (fd < 0) { 181 _warn("_mcleanup: %s", outname); 182 return; 183 } 184#ifdef DEBUG 185 log = _open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664); 186 if (log < 0) { --- 82 unchanged lines hidden --- | 178 fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666); 179 if (fd < 0) { 180 _warn("_mcleanup: %s", outname); 181 return; 182 } 183#ifdef DEBUG 184 log = _open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664); 185 if (log < 0) { --- 82 unchanged lines hidden --- |