[PROTO] correct handling of the flag 'function profiling'
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 18 Oct 2013 12:30:44 +0000 (16:30 +0400)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 21 Oct 2013 13:21:39 +0000 (13:21 +0000)
interval instrumentation:
start message .. stop message
save events function:
only if flag 'function profiling' is true

Change-Id: Iac01a77c32998c252e89513b5adf4a024672f117
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
parser/features.c
parser/msg_cmd.c
us_manager/sspt/ip.c
us_manager/us_manager.c
us_manager/us_manager.h

index 1c5035f..74e560d 100644 (file)
@@ -47,20 +47,16 @@ enum features_list {
 
 int set_us_inst(struct conf_data *conf)
 {
-       int ret;
-
-       ret = usm_start();
+       set_quiet(QT_OFF);
 
-       return ret;
+       return 0;
 }
 
 int unset_us_inst(void)
 {
-       int ret;
-
-       ret = usm_stop();
+       set_quiet(QT_ON);
 
-       return ret;
+       return 0;
 }
 
 int set_syscall_file(struct conf_data *conf)
index ae57e39..2ead7d5 100644 (file)
@@ -82,7 +82,11 @@ int msg_start(struct msg_buf *mb)
                goto free_us_inst;
        }
 
-       return 0;
+       ret = usm_start();
+       if (ret)
+               goto free_us_inst;
+
+       return ret;
 
 free_us_inst:
        destroy_us_inst_data(us_inst);
@@ -101,6 +105,10 @@ int msg_stop(struct msg_buf *mb)
                return -EINVAL;
        }
 
+       ret = usm_stop();
+       if (ret)
+               return ret;
+
        conf.use_features0 = 0;
        conf.use_features1 = 0;
        ret = set_config(&conf);
index 7b6e791..3086ce2 100644 (file)
 #include "sspt_page.h"
 #include "sspt_file.h"
 #include <writer/swap_writer_module.h>
+#include <us_manager/us_manager.h>
 
 
 static int entry_handler(struct uretprobe_instance *ri, struct pt_regs *regs)
 {
        struct us_ip *ip = container_of(ri->rp, struct us_ip, retprobe);
 
-       entry_event(ip->args, regs, PT_US, PST_NONE);
+       if (get_quiet() == QT_OFF)
+               entry_event(ip->args, regs, PT_US, PST_NONE);
 
        return 0;
 }
@@ -48,7 +50,8 @@ static int ret_handler(struct uretprobe_instance *ri, struct pt_regs *regs)
        addr = ip->offset & 0x01 ? addr | 0x01 : addr;
 #endif
 
-       exit_event(regs, addr, ret_addr);
+       if (get_quiet() == QT_OFF)
+               exit_event(regs, addr, ret_addr);
 
        return 0;
 }
index 267cb17..9495e8c 100644 (file)
@@ -27,6 +27,7 @@
 #include "pf/pf_group.h"
 #include "sspt/sspt_proc.h"
 #include "helper.h"
+#include "us_manager.h"
 #include <writer/event_filter.h>
 
 /* FIXME: move /un/init_msg() elsewhere and remove this include  */
@@ -105,6 +106,28 @@ EXPORT_SYMBOL_GPL(usm_start);
 
 
 /* ============================================================================
+ * ===                                QUIET                                 ===
+ * ============================================================================
+ */
+static enum quiet_type quiet = QT_ON;
+
+void set_quiet(enum quiet_type q)
+{
+       quiet = q;
+}
+EXPORT_SYMBOL_GPL(set_quiet);
+
+enum quiet_type get_quiet(void)
+{
+       return quiet;
+}
+EXPORT_SYMBOL_GPL(get_quiet);
+
+
+
+
+
+/* ============================================================================
  * ===                              US_FILTER                               ===
  * ============================================================================
  */
index 979a541..3ef2ffd 100644 (file)
 #ifndef _US_MANAGER_H
 #define _US_MANAGER_H
 
+
+enum quiet_type {
+       QT_ON,
+       QT_OFF
+};
+
+void set_quiet(enum quiet_type q);
+enum quiet_type get_quiet(void);
+
 int usm_start(void);
 int usm_stop(void);