Home | History | Annotate | Download | only in ui
      1 #include <pthread.h>
      2 
      3 #include "../util/cache.h"
      4 #include "../util/debug.h"
      5 #include "../util/hist.h"
      6 
      7 pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
      8 
      9 void setup_browser(bool fallback_to_pager)
     10 {
     11 	if (use_browser < 2 && (!isatty(1) || dump_trace))
     12 		use_browser = 0;
     13 
     14 	/* default to TUI */
     15 	if (use_browser < 0)
     16 		use_browser = 1;
     17 
     18 	switch (use_browser) {
     19 	case 2:
     20 		if (perf_gtk__init() == 0)
     21 			break;
     22 		/* fall through */
     23 	case 1:
     24 		use_browser = 1;
     25 		if (ui__init() == 0)
     26 			break;
     27 		/* fall through */
     28 	default:
     29 		use_browser = 0;
     30 		if (fallback_to_pager)
     31 			setup_pager();
     32 
     33 		perf_hpp__init();
     34 		break;
     35 	}
     36 }
     37 
     38 void exit_browser(bool wait_for_ok)
     39 {
     40 	switch (use_browser) {
     41 	case 2:
     42 		perf_gtk__exit(wait_for_ok);
     43 		break;
     44 
     45 	case 1:
     46 		ui__exit(wait_for_ok);
     47 		break;
     48 
     49 	default:
     50 		break;
     51 	}
     52 }
     53