Report on the bluetooth queue depth watermark to help diagnose cases
where Dolphin blocks long enough to lose packets. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5944 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
637e5e542a
commit
6c7e666a75
|
@ -11,7 +11,6 @@ files = [
|
|||
]
|
||||
|
||||
if sys.platform.count('bsd'):
|
||||
env['LIBS'] += ['usbhid']
|
||||
files += [
|
||||
'src/joystick/bsd/SDL_sysjoystick.c',
|
||||
'src/stdlib/SDL_malloc.c',
|
||||
|
|
|
@ -34,9 +34,8 @@
|
|||
#ifndef DEFINITIONS_H_INCLUDED
|
||||
#define DEFINITIONS_H_INCLUDED
|
||||
|
||||
#if 0 // Use Dolphin logging
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
// NOTICE_LEVEL is more appropriate for the uses of WIIUSE_INFO than INFO_LEVEL
|
||||
// as long as we don't provide adequate GUI feedback for bluetooth events.
|
||||
#define WIIUSE_INFO(...) { GENERIC_LOG(WIIMOTE, NOTICE_LEVEL, __VA_ARGS__) }
|
||||
|
@ -44,43 +43,8 @@
|
|||
#define WIIUSE_WARNING(...) { GENERIC_LOG(WIIMOTE, WARNING_LEVEL, __VA_ARGS__) }
|
||||
#define WIIUSE_DEBUG(...) { GENERIC_LOG(WIIMOTE, DEBUG_LEVEL, __VA_ARGS__) }
|
||||
|
||||
#else
|
||||
|
||||
/* this is wiiuse - used to distinguish from third party programs using wiiuse.h */
|
||||
#include "os.h"
|
||||
|
||||
//#define WITH_WIIUSE_DEBUG
|
||||
|
||||
/* Error output macros */
|
||||
#define WIIUSE_ERROR(fmt, ...) fprintf(stderr, "[ERROR] " fmt "\n", ##__VA_ARGS__)
|
||||
|
||||
/* Warning output macros */
|
||||
#define WIIUSE_WARNING(fmt, ...) fprintf(stderr, "[WARNING] " fmt "\n", ##__VA_ARGS__)
|
||||
|
||||
/* Information output macros */
|
||||
#define WIIUSE_INFO(fmt, ...) fprintf(stderr, "[INFO] " fmt "\n", ##__VA_ARGS__)
|
||||
|
||||
#ifdef WITH_WIIUSE_DEBUG
|
||||
#ifdef WIN32
|
||||
#define WIIUSE_DEBUG(fmt, ...) do { \
|
||||
char* file = __FILE__; \
|
||||
int i = strlen(file) - 1; \
|
||||
for (; i && (file[i] != '\\'); --i); \
|
||||
fprintf(stderr, "[DEBUG] %s:%i: " fmt "\n", file+i+1, __LINE__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define WIIUSE_DEBUG(fmt, ...) fprintf(stderr, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
#define WIIUSE_DEBUG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#endif // Use Dolphin logging
|
||||
|
||||
|
||||
/* Convert to big endian */
|
||||
#define BIG_ENDIAN_LONG(i) (htonl(i))
|
||||
#define BIG_ENDIAN_SHORT(i) (htons(i))
|
||||
|
||||
|
||||
#endif // DEFINITIONS_H_INCLUDED
|
||||
|
|
|
@ -47,12 +47,12 @@ IOBluetoothDevice *btd;
|
|||
IOBluetoothL2CAPChannel *ichan;
|
||||
IOBluetoothL2CAPChannel *cchan;
|
||||
|
||||
#define QUEUE_SIZE 8
|
||||
#define QUEUE_SIZE 64
|
||||
volatile struct buffer {
|
||||
char data[MAX_PAYLOAD];
|
||||
int len;
|
||||
} queue[QUEUE_SIZE];
|
||||
volatile int reader, writer, outstanding;
|
||||
volatile int reader, writer, outstanding, watermark;
|
||||
|
||||
@interface SearchBT: NSObject {
|
||||
@public
|
||||
|
@ -108,6 +108,11 @@ volatile int reader, writer, outstanding;
|
|||
if (writer == QUEUE_SIZE)
|
||||
writer = 0;
|
||||
|
||||
if (outstanding > watermark) {
|
||||
watermark = outstanding;
|
||||
WIIUSE_WARNING("New wiimote queue watermark %d", watermark);
|
||||
}
|
||||
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
}
|
||||
|
||||
|
@ -165,8 +170,10 @@ int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
|
|||
[bti setDelegate: sbt];
|
||||
[bti setInquiryLength: timeout];
|
||||
[bti setSearchCriteria: kBluetoothServiceClassMajorAny
|
||||
majorDeviceClass: 0x05 minorDeviceClass: 0x01];
|
||||
[bti setUpdateNewDeviceNames: FALSE];
|
||||
majorDeviceClass: kBluetoothDeviceClassMajorPeripheral
|
||||
minorDeviceClass: kBluetoothDeviceClassMinorPeripheral2Joystick
|
||||
];
|
||||
[bti setUpdateNewDeviceNames: NO];
|
||||
|
||||
IOReturn ret = [bti start];
|
||||
if (ret == kIOReturnSuccess)
|
||||
|
@ -256,7 +263,6 @@ static int wiiuse_connect_single(struct wiimote_t *wm, char *address)
|
|||
WIIUSE_INFO("Connected to wiimote [id %i].", wm->unid);
|
||||
|
||||
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED);
|
||||
wiiuse_handshake(wm, NULL, 0);
|
||||
wiiuse_set_report_type(wm);
|
||||
|
||||
[cbt release];
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* wiiuse
|
||||
*
|
||||
* Written By:
|
||||
* Michael Laforest < para >
|
||||
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
|
||||
*
|
||||
* Copyright 2006-2007
|
||||
*
|
||||
* This file is part of wiiuse.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Operating system related definitions.
|
||||
*
|
||||
* This file is an attempt to separate operating system
|
||||
* dependent functions and choose what should be used
|
||||
* at compile time.
|
||||
*/
|
||||
|
||||
#ifndef OS_H_INCLUDED
|
||||
#define OS_H_INCLUDED
|
||||
|
||||
#ifdef WIN32
|
||||
/* windows */
|
||||
|
||||
|
||||
/* disable warnings I don't care about */
|
||||
#pragma warning(disable:4244) /* possible loss of data conversion */
|
||||
#pragma warning(disable:4273) /* inconsistent dll linkage */
|
||||
#pragma warning(disable:4217)
|
||||
#else
|
||||
/* nix */
|
||||
#endif
|
||||
|
||||
|
||||
#endif // OS_H_INCLUDED
|
|
@ -20,7 +20,7 @@ files = [
|
|||
|
||||
libs = [ 'inputcommon', 'common' ]
|
||||
|
||||
if sys.platform == 'win32' or sys.platform == 'linux2':
|
||||
if not sys.platform == 'darwin':
|
||||
libs += [ 'SDL' ]
|
||||
|
||||
if env['HAVE_WX']:
|
||||
|
|
Loading…
Reference in New Issue