hwpmc_mod.c (255133) | hwpmc_mod.c (255745) |
---|---|
1/*- 2 * Copyright (c) 2003-2008 Joseph Koshy 3 * Copyright (c) 2007 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by A. Joseph Koshy under 7 * sponsorship from the FreeBSD Foundation and Google, Inc. 8 * --- 16 unchanged lines hidden (view full) --- 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2008 Joseph Koshy 3 * Copyright (c) 2007 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by A. Joseph Koshy under 7 * sponsorship from the FreeBSD Foundation and Google, Inc. 8 * --- 16 unchanged lines hidden (view full) --- 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_mod.c 255133 2013-09-01 21:44:43Z davide $"); | 33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_mod.c 255745 2013-09-20 23:06:21Z davide $"); |
34 35#include <sys/param.h> 36#include <sys/eventhandler.h> 37#include <sys/jail.h> 38#include <sys/kernel.h> 39#include <sys/kthread.h> 40#include <sys/limits.h> 41#include <sys/lock.h> --- 1980 unchanged lines hidden (view full) --- 2022 struct pmc_ownerhash *poh; 2023 2024 hindex = PMC_HASH_PTR(p, pmc_ownerhashmask); 2025 poh = &pmc_ownerhash[hindex]; 2026 2027 /* allocate space for N pointers and one descriptor struct */ 2028 po = malloc(sizeof(struct pmc_owner), M_PMC, M_WAITOK|M_ZERO); 2029 po->po_owner = p; | 34 35#include <sys/param.h> 36#include <sys/eventhandler.h> 37#include <sys/jail.h> 38#include <sys/kernel.h> 39#include <sys/kthread.h> 40#include <sys/limits.h> 41#include <sys/lock.h> --- 1980 unchanged lines hidden (view full) --- 2022 struct pmc_ownerhash *poh; 2023 2024 hindex = PMC_HASH_PTR(p, pmc_ownerhashmask); 2025 poh = &pmc_ownerhash[hindex]; 2026 2027 /* allocate space for N pointers and one descriptor struct */ 2028 po = malloc(sizeof(struct pmc_owner), M_PMC, M_WAITOK|M_ZERO); 2029 po->po_owner = p; |
2030 LIST_INIT(&po->po_pmcs); |
|
2030 LIST_INSERT_HEAD(poh, po, po_next); /* insert into hash table */ 2031 2032 TAILQ_INIT(&po->po_logbuffers); 2033 mtx_init(&po->po_mtx, "pmc-owner-mtx", "pmc-per-proc", MTX_SPIN); 2034 2035 PMCDBG(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p", 2036 p, p->p_pid, p->p_comm, po); 2037 --- 109 unchanged lines hidden (view full) --- 2147 */ 2148 2149static struct pmc * 2150pmc_allocate_pmc_descriptor(void) 2151{ 2152 struct pmc *pmc; 2153 2154 pmc = malloc(sizeof(struct pmc), M_PMC, M_WAITOK|M_ZERO); | 2031 LIST_INSERT_HEAD(poh, po, po_next); /* insert into hash table */ 2032 2033 TAILQ_INIT(&po->po_logbuffers); 2034 mtx_init(&po->po_mtx, "pmc-owner-mtx", "pmc-per-proc", MTX_SPIN); 2035 2036 PMCDBG(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p", 2037 p, p->p_pid, p->p_comm, po); 2038 --- 109 unchanged lines hidden (view full) --- 2148 */ 2149 2150static struct pmc * 2151pmc_allocate_pmc_descriptor(void) 2152{ 2153 struct pmc *pmc; 2154 2155 pmc = malloc(sizeof(struct pmc), M_PMC, M_WAITOK|M_ZERO); |
2156 LIST_INIT(&pmc->pm_targets); |
|
2155 2156 PMCDBG(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc); 2157 2158 return pmc; 2159} 2160 2161/* 2162 * Destroy a pmc descriptor. --- 2958 unchanged lines hidden --- | 2157 2158 PMCDBG(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc); 2159 2160 return pmc; 2161} 2162 2163/* 2164 * Destroy a pmc descriptor. --- 2958 unchanged lines hidden --- |