File: addr_location.c

package info (click to toggle)
linux 6.19.2-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,759,612 kB
  • sloc: ansic: 27,004,852; asm: 273,402; sh: 151,313; python: 81,277; makefile: 58,544; perl: 34,311; xml: 21,064; cpp: 5,984; yacc: 4,841; lex: 2,901; awk: 1,707; sed: 30; ruby: 25
file content (45 lines) | stat: -rw-r--r-- 1,078 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GPL-2.0
#include "addr_location.h"
#include "map.h"
#include "maps.h"
#include "thread.h"

void addr_location__init(struct addr_location *al)
{
	al->thread = NULL;
	al->maps = NULL;
	al->map = NULL;
	al->sym = NULL;
	al->srcline = NULL;
	al->addr = 0;
	al->level = 0;
	al->filtered = 0;
	al->cpumode = 0;
	al->cpu = 0;
	al->socket = 0;
	al->parallelism = 1;
}

/*
 * The preprocess_sample method will return with reference counts for the
 * in it, when done using (and perhaps getting ref counts if needing to
 * keep a pointer to one of those entries) it must be paired with
 * addr_location__put(), so that the refcounts can be decremented.
 */
void addr_location__exit(struct addr_location *al)
{
	map__zput(al->map);
	thread__zput(al->thread);
	maps__zput(al->maps);
}

void addr_location__copy(struct addr_location *dst, struct addr_location *src)
{
	thread__put(dst->thread);
	maps__put(dst->maps);
	map__put(dst->map);
	*dst = *src;
	dst->thread = thread__get(src->thread);
	dst->maps = maps__get(src->maps);
	dst->map = map__get(src->map);
}