blob: 11cdbce01f6ba8a10d642564857360595ec56f08 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13/*
14per.c
15
16DESCRIPTION: Performance count interface for linux via proc in the T32
17command file style
18*/
19
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/sysrq.h>
24#include <linux/time.h>
25#include "linux/proc_fs.h"
26#include "linux/kernel_stat.h"
27#include "asm/uaccess.h"
28#include "cp15_registers.h"
29#include "perf.h"
30
31#define PM_PER_ERR -1
32/*
33FUNCTION perf_if_proc_init
34
35DESCRIPTION Initialize the proc interface for thje performance data.
36*/
37static __init int per_init(void)
38{
39
40 if (atomic_read(&pm_op_lock) == 1) {
41 printk(KERN_INFO "Can not load KSAPI, monitors are in use\n");
42 return PM_PER_ERR;
43 }
44 atomic_set(&pm_op_lock, 1);
45 per_process_perf_init();
46 printk(KERN_INFO "ksapi init\n");
47 return 0;
48}
49
50static void __exit per_exit(void)
51{
52 per_process_perf_exit();
53 printk(KERN_INFO "ksapi exit\n");
54 atomic_set(&pm_op_lock, 0);
55}
56
57MODULE_LICENSE("GPL v2");
58module_init(per_init);
59module_exit(per_exit);