1 /****************************************************************************** 2 * 3 * Copyright (C) 2015 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #include <unistd.h> 20 #include <sys/time.h> 21 22 #include "btif/include/btif_debug.h" 23 #include "btif/include/btif_debug_btsnoop.h" 24 #include "btif/include/btif_debug_conn.h" 25 #include "include/bt_target.h" 26 27 void btif_debug_init(void) { 28 #if defined(BTSNOOP_MEM) && (BTSNOOP_MEM == TRUE) 29 btif_debug_btsnoop_init(); 30 #endif 31 } 32 33 void btif_debug_dump(int fd) { 34 btif_debug_conn_dump(fd); 35 #if defined(BTSNOOP_MEM) && (BTSNOOP_MEM == TRUE) 36 btif_debug_btsnoop_dump(fd); 37 #endif 38 39 close(fd); 40 } 41 42 // TODO: Find a better place for this to enable additional re-use 43 uint64_t btif_debug_ts(void) { 44 struct timeval tv; 45 gettimeofday(&tv, NULL); 46 return (tv.tv_sec * 1000000LL) + tv.tv_usec; 47 } 48