perfcnt.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stropts.h>
#include <link.h>
#include <fcntl.h>
#include <signal.h>
#include "env.h"
#include "hash.h"
typedef struct {
float d_time;
int d_count;
const char *d_symname;
} d_entry;
typedef struct list {
} List;
static Elist *bindto_list = 0;
static Elist *bindfrom_list = 0;
static int initialized;
extern long long gethrvtime();
static const char *progname;
static long long starts[1000];
static int counter = 0;
static float total_time = 0.0;
static void
{
(void) printf("libperfcnt.so: malloc failed - "
"can't print summary\n");
exit(1);
}
if (list_head == 0) {
return;
}
;
/*
* insert at head of list
*/
if (prev == 0) {
return;
}
}
{
int fd;
char buffer[100];
if (version > LAV_CURRENT)
version);
perror("PIOCSET");
}
initialized++;
/*
* Initalize iset to the full set of signals to be masked durring
*/
(void) sigfillset(&iset);
return (LAV_CURRENT);
}
/* ARGSUSED1 */
{
static int first = 1;
if (first) {
first = 0;
}
if (bindto_list == 0)
else {
}
if (bindfrom_list == 0)
flags |= LA_FLG_BINDFROM;
else {
flags |= LA_FLG_BINDFROM;
}
return (flags);
}
/* ARGSUSED1 */
#if defined(__sparcv9)
const char *sym_name)
const char *sym_name)
#endif
{
counter++;
}
/* ARGSUSED1 */
#if defined(_LP64)
/* ARGSUSED */
#else
#endif
{
long long time_used;
#if !defined(_LP64)
#endif
counter--;
/* LINTED */
}
if (counter)
return (retval);
}
/* ARGSUSED1 */
static void
{
}
static void
cleanup()
{
(void) printf("%20s\tc_count\t tim\t\tavg. tim\ttot. %%\n",
"SYMBOL");
(void) printf("--------------------------------------------------"
"-------------------\n");
(void) printf("%20s\t%d\t%8.2f\t%8.2f\t%2.2f%%\n",
}
(void) printf("--------------------------------------------------"
"-------------------\n");
(void) printf("\t\t\t\t\t\tTotal Time: %8.2f\n",
total_time * 1000000);
}