aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2018-10-20 07:50:03 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2018-10-20 07:50:03 -0400
commit1631170f028d83ff5d3313572c8ebeb920e66cf6 (patch)
tree2d0267e0b4893088803896e1759827ca4922b056
parentremoving ldd_utils.o (diff)
downloadfirejail-1631170f028d83ff5d3313572c8ebeb920e66cf6.tar.gz
firejail-1631170f028d83ff5d3313572c8ebeb920e66cf6.tar.zst
firejail-1631170f028d83ff5d3313572c8ebeb920e66cf6.zip
cleanup
-rw-r--r--src/include/common.h2
-rw-r--r--src/lib/common.c39
2 files changed, 0 insertions, 41 deletions
diff --git a/src/include/common.h b/src/include/common.h
index a80ad4688..7a2b87eda 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -124,8 +124,6 @@ static inline unsigned long long getticks(void) {
124#endif 124#endif
125} 125}
126 126
127void timetrace_start(void);
128float timetrace_end(void);
129int join_namespace(pid_t pid, char *type); 127int join_namespace(pid_t pid, char *type);
130int name2pid(const char *name, pid_t *pid); 128int name2pid(const char *name, pid_t *pid);
131char *pid_proc_comm(const pid_t pid); 129char *pid_proc_comm(const pid_t pid);
diff --git a/src/lib/common.c b/src/lib/common.c
index d6dd43c4b..98fb82c11 100644
--- a/src/lib/common.c
+++ b/src/lib/common.c
@@ -286,42 +286,3 @@ int pid_hidepid(void) {
286 fclose(fp); 286 fclose(fp);
287 return 0; 287 return 0;
288} 288}
289
290//**************************
291// time trace based on getticks function
292//**************************
293static int tt_not_implemented = 0; // not implemented for the current architecture
294static unsigned long long tt_1ms = 0;
295static unsigned long long tt = 0; // start time
296
297void timetrace_start(void) {
298 if (tt_not_implemented)
299 return;
300 unsigned long long t1 = getticks();
301 if (t1 == 0) {
302 tt_not_implemented = 1;
303 return;
304 }
305
306 if (tt_1ms == 0) {
307 usleep(1000); // sleep 1 ms
308 unsigned long long t2 = getticks();
309 tt_1ms = t2 - t1;
310 if (tt_1ms == 0) {
311 tt_not_implemented = 1;
312 return;
313 }
314 }
315
316 tt = getticks();
317}
318
319float timetrace_end(void) {
320 if (tt_not_implemented)
321 return 0;
322
323 unsigned long long delta = getticks() - tt;
324 assert(tt_1ms);
325
326 return (float) delta / (float) tt_1ms;
327}