1203790Sfabient/*- 2203790Sfabient * Copyright (c) 2005-2007, Joseph Koshy 3203790Sfabient * Copyright (c) 2007 The FreeBSD Foundation 4203790Sfabient * All rights reserved. 5203790Sfabient * 6203790Sfabient * Portions of this software were developed by A. Joseph Koshy under 7203790Sfabient * sponsorship from the FreeBSD Foundation and Google, Inc. 8203790Sfabient * 9203790Sfabient * Redistribution and use in source and binary forms, with or without 10203790Sfabient * modification, are permitted provided that the following conditions 11203790Sfabient * are met: 12203790Sfabient * 1. Redistributions of source code must retain the above copyright 13203790Sfabient * notice, this list of conditions and the following disclaimer. 14203790Sfabient * 2. Redistributions in binary form must reproduce the above copyright 15203790Sfabient * notice, this list of conditions and the following disclaimer in the 16203790Sfabient * documentation and/or other materials provided with the distribution. 17203790Sfabient * 18203790Sfabient * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19203790Sfabient * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20203790Sfabient * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21203790Sfabient * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22203790Sfabient * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23203790Sfabient * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24203790Sfabient * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25203790Sfabient * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26203790Sfabient * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27203790Sfabient * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28203790Sfabient * SUCH DAMAGE. 29203790Sfabient * 30203790Sfabient * $FreeBSD$ 31203790Sfabient */ 32203790Sfabient 33203790Sfabient#ifndef _PMCSTAT_PL_CALLGRAPH_H_ 34203790Sfabient#define _PMCSTAT_PL_CALLGRAPH_H_ 35203790Sfabient 36203790Sfabient/* 37203790Sfabient * Each call graph node is tracked by a pmcstat_cgnode struct. 38203790Sfabient */ 39203790Sfabient 40203790Sfabientstruct pmcstat_cgnode { 41203790Sfabient struct pmcstat_image *pcg_image; 42203790Sfabient uintfptr_t pcg_func; 43203790Sfabient uint32_t pcg_count; 44203790Sfabient uint32_t pcg_nchildren; 45203790Sfabient LIST_ENTRY(pmcstat_cgnode) pcg_sibling; 46203790Sfabient LIST_HEAD(,pmcstat_cgnode) pcg_children; 47203790Sfabient}; 48203790Sfabient 49203790Sfabientstruct pmcstat_cgnode_hash { 50203790Sfabient struct pmcstat_cgnode *pch_cgnode; 51203790Sfabient pmc_id_t pch_pmcid; 52203790Sfabient LIST_ENTRY(pmcstat_cgnode_hash) pch_next; 53203790Sfabient}; 54203790Sfabientextern LIST_HEAD(pmcstat_cgnode_hash_list, pmcstat_cgnode_hash) pmcstat_cgnode_hash[PMCSTAT_NHASH]; 55203790Sfabientextern int pmcstat_cgnode_hash_count; 56203790Sfabient 57203790Sfabient/* Function prototypes */ 58203790Sfabientint pmcpl_cg_init(void); 59203790Sfabientvoid pmcpl_cg_shutdown(FILE *mf); 60203790Sfabientvoid pmcpl_cg_process( 61203790Sfabient struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr, 62203790Sfabient uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu); 63203790Sfabientint pmcpl_cg_topkeypress(int c, WINDOW *w); 64203790Sfabientvoid pmcpl_cg_topdisplay(void); 65203790Sfabientvoid pmcpl_cg_configure(char *opt); 66203790Sfabient 67203790Sfabient#endif /* _PMCSTAT_PL_CALLGRAPH_H_ */ 68