1
/*
2
 * Copyright (C) 2009-2010 Nokia Corporation
3
 *
4
 * Authors:
5
 * Felipe Contreras <felipe.contreras@nokia.com>
6
 * Johann Prieur <johann.prieur@nokia.com>
7
 *
8
 * This file may be used under the terms of the GNU Lesser General Public
9
 * License version 2.1, a copy of which is found in LICENSE included in the
10
 * packaging of this file.
11
 */
12
13
#include <stdio.h>
14
#include <stdbool.h>
15
#include <unistd.h> /* for usleep */
16
17
#include "dsp_bridge.h"
18
19
static unsigned delay = 500; /* in ms */
20
21
static void display(void)
22
{
23
	int dsp_handle;
24
	void *proc_handle;
25
	struct dsp_info info;
26
27
	dsp_handle = dsp_open();
28
	if (dsp_handle < 0)
29
		return;
30
	if (!dsp_attach(dsp_handle, 0, NULL, &proc_handle))
31
		goto leave;
32
	do {
33
		dsp_proc_get_info(dsp_handle, proc_handle, DSP_RESOURCE_PROCLOAD, &info, sizeof(info));
34
35
		printf("load: %lu, freq: %lu\n",
36
				info.result.proc.pred_load,
37
				info.result.proc.pred_freq);
38
39
		usleep(delay * 1000);
40
	} while (true);
41
leave:
42
	if (proc_handle)
43
		dsp_detach(dsp_handle, proc_handle);
44
	dsp_close(dsp_handle);
45
}
46
47
int main(int argc, char *argv[])
48
{
49
	display();
50
	return 0;
51
}