File: libprofiling_tool.c

package info (click to toggle)
starpu 1.4.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 38,692 kB
  • sloc: ansic: 324,396; sh: 7,181; makefile: 6,636; lisp: 6,055; xml: 5,031; f90: 4,994; python: 2,398; cpp: 1,353; java: 330; sed: 162; pascal: 57; fortran: 25
file content (76 lines) | stat: -rw-r--r-- 2,668 bytes parent folder | download | duplicates (3)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* StarPU --- Runtime system for heterogeneous multicore architectures.
 *
 * Copyright (C) 2022  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
 * Copyright (C) 2022  Camille Coti
 *
 * StarPU is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 *
 * StarPU is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
 */

#include <starpu.h>
#include <starpu_profiling_tool.h>

void myfunction_cb(struct starpu_prof_tool_info *prof_info, union starpu_prof_tool_event_info *event_info, struct starpu_prof_tool_api_info *api_info)
{
	if (NULL != prof_info)
	{
		printf("CALLBACK CALLED %d\n", prof_info->event_type);
	}
	else
	{
		printf("CALLBACK CALLED NULL INFO\n");
		return;
	}

	switch (prof_info->event_type)
	{
	case starpu_prof_tool_event_driver_init:
		printf("init driver\n");
		break;
	case starpu_prof_tool_event_driver_init_start:
		printf("begin init driver\n");
		break;
	case starpu_prof_tool_event_driver_init_end:
		printf("end init driver\n");
		break;
	case starpu_prof_tool_event_start_cpu_exec:
		printf("Start exec fun %p on device %d\n", prof_info->fun_ptr, prof_info->device_number);
		break;
	case starpu_prof_tool_event_end_cpu_exec:
		printf("End exec fun %p on device %d\n", prof_info->fun_ptr, prof_info->device_number);
		break;
	case starpu_prof_tool_event_start_transfer:
		printf("Start transfer on memnode %ud\n", prof_info->memnode);
		break;
	case starpu_prof_tool_event_end_transfer:
		printf("End transfer on memnode %ud\n", prof_info->memnode);
		break;
	default:
		printf("Unknown callback %d\n",  prof_info->event_type);
		break;
	}
}

/* Mandatory */
void starpu_prof_tool_library_register(starpu_prof_tool_entry_register_func reg, starpu_prof_tool_entry_register_func unreg)
{
	enum  starpu_prof_tool_command info = 0;
	reg(starpu_prof_tool_event_driver_init, &myfunction_cb, info);
	reg(starpu_prof_tool_event_driver_init_start, &myfunction_cb, info);
	reg(starpu_prof_tool_event_driver_init_end, &myfunction_cb, info);
	reg(starpu_prof_tool_event_start_cpu_exec, &myfunction_cb, info);
	reg(starpu_prof_tool_event_end_cpu_exec, &myfunction_cb, info);
	reg(starpu_prof_tool_event_start_transfer, &myfunction_cb, info);
	reg(starpu_prof_tool_event_end_transfer, &myfunction_cb, info);

	fprintf(stderr,"REGISTER LIBRARY\n");
}