1 /* 2 * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz> 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /* 19 20 Timer measuring library. 21 22 The test is supposed to define sampling function and set it in the tst_test 23 structure the rest of the work is then done by the library. 24 25 int sample(int clk_id, long long usec) 26 { 27 // Any setup done here 28 29 tst_timer_start(clk_id); 30 // Call that is being measured sleeps for usec 31 tst_timer_stop(); 32 tst_timer_sample(); 33 34 // Any cleanup done here 35 36 // Non-zero return exits the test 37 } 38 39 struct tst_test test = { 40 .scall = "syscall_name()", 41 .sample = sample, 42 }; 43 44 */ 45 46 #ifndef TST_TIMER_TEST__ 47 #define TST_TIMER_TEST__ 48 49 #include "tst_test.h" 50 #include "tst_timer.h" 51 52 void tst_timer_sample(void); 53 54 # ifdef TST_NO_DEFAULT_MAIN 55 struct tst_test *tst_timer_test_setup(struct tst_test *test); 56 # endif /* TST_NO_DEFAULT_MAIN */ 57 #endif /* TST_TIMER_TEST__ */ 58