patch 8.1.1684: profiling functionality is spread out
Problem: Profiling functionality is spread out.
Solution: Put profiling functionality in profiling.c. (Yegappan Lakshmanan,
closes #4666)
diff --git a/src/proto/ex_cmds2.pro b/src/proto/ex_cmds2.pro
index c12e0d7..ee74b0b 100644
--- a/src/proto/ex_cmds2.pro
+++ b/src/proto/ex_cmds2.pro
@@ -1,12 +1,4 @@
/* ex_cmds2.c */
-void profile_start(proftime_T *tm);
-void profile_end(proftime_T *tm);
-void profile_sub(proftime_T *tm, proftime_T *tm2);
-char *profile_msg(proftime_T *tm);
-float_T profile_float(proftime_T *tm);
-void profile_setlimit(long msec, proftime_T *tm);
-int profile_passed_limit(proftime_T *tm);
-void profile_zero(proftime_T *tm);
long proftime_time_left(proftime_T *due, proftime_T *now);
timer_T *create_timer(long msec, int repeat);
long check_due_timer(void);
@@ -17,22 +9,10 @@
void add_timer_info_all(typval_T *rettv);
int set_ref_in_timer(int copyID);
void timer_free_all(void);
-void profile_divide(proftime_T *tm, int count, proftime_T *tm2);
-void profile_add(proftime_T *tm, proftime_T *tm2);
-void profile_self(proftime_T *self, proftime_T *total, proftime_T *children);
-void profile_get_wait(proftime_T *tm);
-void profile_sub_wait(proftime_T *tm, proftime_T *tma);
-int profile_equal(proftime_T *tm1, proftime_T *tm2);
-int profile_cmp(const proftime_T *tm1, const proftime_T *tm2);
-void ex_profile(exarg_T *eap);
-char_u *get_profile_name(expand_T *xp, int idx);
-void set_context_in_profile_cmd(expand_T *xp, char_u *arg);
-void profile_dump(void);
+void script_do_profile(scriptitem_T *si);
void script_prof_save(proftime_T *tm);
void script_prof_restore(proftime_T *tm);
-void prof_inchar_enter(void);
-void prof_inchar_exit(void);
-int prof_def_func(void);
+void script_dump_profile(FILE *fd);
int autowrite(buf_T *buf, int forceit);
void autowrite_all(void);
int check_changed(buf_T *buf, int flags);
diff --git a/src/proto/profiler.pro b/src/proto/profiler.pro
new file mode 100644
index 0000000..e7bcb47
--- /dev/null
+++ b/src/proto/profiler.pro
@@ -0,0 +1,34 @@
+/* profiler.c */
+void profile_start(proftime_T *tm);
+void profile_end(proftime_T *tm);
+void profile_sub(proftime_T *tm, proftime_T *tm2);
+char *profile_msg(proftime_T *tm);
+float_T profile_float(proftime_T *tm);
+void profile_setlimit(long msec, proftime_T *tm);
+int profile_passed_limit(proftime_T *tm);
+void profile_zero(proftime_T *tm);
+void profile_divide(proftime_T *tm, int count, proftime_T *tm2);
+void profile_add(proftime_T *tm, proftime_T *tm2);
+void profile_self(proftime_T *self, proftime_T *total, proftime_T *children);
+void profile_get_wait(proftime_T *tm);
+void profile_sub_wait(proftime_T *tm, proftime_T *tma);
+int profile_equal(proftime_T *tm1, proftime_T *tm2);
+int profile_cmp(const proftime_T *tm1, const proftime_T *tm2);
+void ex_profile(exarg_T *eap);
+char_u *get_profile_name(expand_T *xp, int idx);
+void set_context_in_profile_cmd(expand_T *xp, char_u *arg);
+void profile_dump(void);
+void prof_inchar_enter(void);
+void prof_inchar_exit(void);
+int prof_def_func(void);
+void prof_sort_list(FILE *fd, ufunc_T **sorttab, int st_len, char *title, int prefer_self);
+void prof_func_line(FILE *fd, int count, proftime_T *total, proftime_T *self, int prefer_self);
+int prof_total_cmp(const void *s1, const void *s2);
+int prof_self_cmp(const void *s1, const void *s2);
+void func_do_profile(ufunc_T *fp);
+void prof_child_enter(proftime_T *tm);
+void prof_child_exit(proftime_T *tm);
+void func_line_start(void *cookie);
+void func_line_exec(void *cookie);
+void func_line_end(void *cookie);
+/* vim: set ft=c : */
diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro
index c9dd974..8395e01 100644
--- a/src/proto/userfunc.pro
+++ b/src/proto/userfunc.pro
@@ -6,6 +6,7 @@
ufunc_T *find_func(char_u *name);
void save_funccal(funccal_entry_T *entry);
void restore_funccal(void);
+funccall_T * get_current_funccal(void);
void free_all_functions(void);
int func_call(char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict, typval_T *rettv);
int call_callback(callback_T *callback, int len, typval_T *rettv, int argcount, typval_T *argvars, int (*argv_func)(int, typval_T *, int), linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict);
@@ -17,8 +18,6 @@
int function_exists(char_u *name, int no_deref);
char_u *get_expanded_name(char_u *name, int check);
void func_dump_profile(FILE *fd);
-void prof_child_enter(proftime_T *tm);
-void prof_child_exit(proftime_T *tm);
char_u *get_user_func_name(expand_T *xp, int idx);
void ex_delfunction(exarg_T *eap);
void func_unref(char_u *name);