git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2929 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
@@ -17,28 +17,33 @@ Nedko Arnaudov | |||
Fernando Lopez-Lezcano | |||
Romain Moret | |||
Florian Faber | |||
Michael Voigt | |||
--------------------------- | |||
Jackdmp changes log | |||
--------------------------- | |||
2008-08-17 Stephane Letz <letz@grame.fr> | |||
2008-08-19 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt JackTime patch. | |||
2008-09-17 Stephane Letz <letz@grame.fr> | |||
* New JackDriverInfo class to cleanup driver loading code. | |||
2008-08-08 Stephane Letz <letz@grame.fr> | |||
2008-09-08 Stephane Letz <letz@grame.fr> | |||
* Better symbols export for server and client side libraries. | |||
2008-08-06 Stephane Letz <letz@grame.fr> | |||
2008-09-06 Stephane Letz <letz@grame.fr> | |||
* Correct driver hierarchy on macosx and windows targets. | |||
2008-08-05 Stephane Letz <letz@grame.fr> | |||
2008-09-05 Stephane Letz <letz@grame.fr> | |||
* Merge Michael Voigt "drops" branch after reorganization step. | |||
2008-08-04 Stephane Letz <letz@grame.fr> | |||
2008-09-04 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt 4th source reorganization patch. | |||
* Correct JackNetDriver initialization. | |||
@@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackDriver.h" | |||
#include "JackTime.h" | |||
#include "JackError.h" | |||
@@ -785,12 +785,10 @@ Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver | |||
if (fHandle == NULL) { | |||
#ifdef WIN32 | |||
if ((errstr = GetLastError ()) != 0) { | |||
jack_error ("can't load \"%s\": %ld", driver_desc->file, | |||
errstr); | |||
jack_error ("can't load \"%s\": %ld", driver_desc->file, errstr); | |||
#else | |||
if ((errstr = dlerror ()) != 0) { | |||
jack_error ("can't load \"%s\": %s", driver_desc->file, | |||
errstr); | |||
jack_error ("can't load \"%s\": %s", driver_desc->file, errstr); | |||
#endif | |||
} else { | |||
@@ -26,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <assert.h> | |||
#include "JackSystemDeps.h" | |||
#include "JackLockedEngine.h" | |||
#include "JackExternalClient.h" | |||
#include "JackInternalClient.h" | |||
@@ -23,7 +23,6 @@ This program is free software; you can redistribute it and/or modify | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackGraphManager.h" | |||
#include "JackInternalClient.h" | |||
#include "JackServer.h" | |||
@@ -1,122 +0,0 @@ | |||
/* | |||
Copyright (C) 2001-2003 Paul Davis | |||
Copyright (C) 2004-2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU Lesser General Public License as published by | |||
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#if defined(HAVE_CONFIG_H) | |||
#include "config.h" | |||
#endif | |||
#include "JackTime.h" | |||
#include "JackError.h" | |||
#ifdef __APPLE__ | |||
double __jack_time_ratio; | |||
/* This should only be called ONCE per process. */ | |||
void InitTime() | |||
{ | |||
jack_log("InitTime"); | |||
mach_timebase_info_data_t info; | |||
mach_timebase_info(&info); | |||
__jack_time_ratio = ((float)info.numer / info.denom) / 1000; | |||
} | |||
#endif | |||
#ifdef WIN32 | |||
SERVER_EXPORT LARGE_INTEGER _jack_freq; | |||
void InitTime() | |||
{ | |||
QueryPerformanceFrequency(&_jack_freq); | |||
jack_log("InitTime freq = %ld %ld", _jack_freq.HighPart, _jack_freq.LowPart); | |||
_jack_freq.QuadPart = _jack_freq.QuadPart / 1000000; // by usec | |||
} | |||
jack_time_t GetMicroSeconds(void) | |||
{ | |||
LARGE_INTEGER t1; | |||
QueryPerformanceCounter (&t1); | |||
return (jack_time_t)(((double)t1.QuadPart)/((double)_jack_freq.QuadPart)); | |||
} | |||
// TODO | |||
#endif | |||
#ifdef linux | |||
#ifdef GETCYCLE_TIME | |||
#include <stdio.h> | |||
jack_time_t GetMhz(void) | |||
{ | |||
FILE *f = fopen("/proc/cpuinfo", "r"); | |||
if (f == 0) { | |||
perror("can't open /proc/cpuinfo\n"); | |||
exit(1); | |||
} | |||
for (;;) { | |||
jack_time_t mhz; | |||
int ret; | |||
char buf[1000]; | |||
if (fgets(buf, sizeof(buf), f) == NULL) { | |||
jack_error ("FATAL: cannot locate cpu MHz in " | |||
"/proc/cpuinfo\n"); | |||
exit(1); | |||
} | |||
#if defined(__powerpc__) | |||
ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz); | |||
#elif defined( __i386__ ) || defined (__hppa__) || defined (__ia64__) || \ | |||
defined(__x86_64__) | |||
ret = sscanf(buf, "cpu MHz : %" SCNu64, &mhz); | |||
#elif defined( __sparc__ ) | |||
ret = sscanf(buf, "Cpu0Bogo : %" SCNu64, &mhz); | |||
#elif defined( __mc68000__ ) | |||
ret = sscanf(buf, "Clocking: %" SCNu64, &mhz); | |||
#elif defined( __s390__ ) | |||
ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz); | |||
#else /* MIPS, ARM, alpha */ | |||
ret = sscanf(buf, "BogoMIPS : %" SCNu64, &mhz); | |||
#endif | |||
if (ret == 1) { | |||
fclose(f); | |||
return (jack_time_t)mhz; | |||
} | |||
} | |||
} | |||
jack_time_t __jack_cpu_mhz; | |||
void InitTime() | |||
{ | |||
__jack_cpu_mhz = GetMhz(); | |||
} | |||
#else | |||
void InitTime() | |||
{} | |||
#endif | |||
#endif |
@@ -23,11 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "types.h" | |||
#include "JackCompilerDeps.h" | |||
#include <stdio.h> | |||
#include "JackTime_os.h" | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#endif | |||
SERVER_EXPORT void InitTime(); | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(); | |||
SERVER_EXPORT void JackSleep(long usec); | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif |
@@ -32,16 +32,16 @@ | |||
#include <sys/syslimits.h> | |||
#endif | |||
#include "jslist.h" | |||
#include "driver_interface.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackError.h" | |||
#include <string> | |||
#include <algorithm> | |||
#include <vector> | |||
#include <iostream> | |||
#include <fstream> | |||
#include "jslist.h" | |||
#include "driver_interface.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackError.h" | |||
namespace Jack | |||
{ | |||
@@ -78,7 +78,6 @@ def build(bld): | |||
'JackEngineControl.cpp', | |||
'JackShmMem.cpp', | |||
'shm.c', | |||
'JackTime.c', | |||
'JackGlobals.cpp', | |||
'JackDebugClient.cpp', | |||
'JackTransportEngine.cpp', | |||
@@ -97,6 +96,7 @@ def build(bld): | |||
'../posix/JackFifo.cpp', | |||
'../posix/JackProcessSync.cpp', | |||
'../posix/JackSocket.cpp', | |||
'../linux/JackLinuxTime.c', | |||
] | |||
includes = ['../linux', '../posix'] + includes | |||
uselib.append('RT') | |||
@@ -109,6 +109,7 @@ def build(bld): | |||
'../macosx/JackMachThread.cpp', | |||
'../macosx/JackMachSemaphore.cpp', | |||
'../macosx/JackMachPort.cpp', | |||
'../macosx/JackMachTime.c', | |||
] | |||
includes = ['../macosx', '../macosx/RPC', '../posix'] + includes | |||
@@ -0,0 +1,101 @@ | |||
/* | |||
Copyright (C) 2001-2003 Paul Davis | |||
Copyright (C) 2004-2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU Lesser General Public License as published by | |||
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#if defined(HAVE_CONFIG_H) | |||
#include "config.h" | |||
#endif | |||
#include "JackTime.h" | |||
#include <unistd.h> | |||
SERVER_EXPORT void JackSleep(long usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#ifdef GETCYCLE_TIME | |||
#include <stdio.h> | |||
#include "cycles.h" | |||
static jack_time_t __jack_cpu_mhz; | |||
static inline jack_time_t GetMhz(void) | |||
{ | |||
FILE *f = fopen("/proc/cpuinfo", "r"); | |||
if (f == 0) { | |||
perror("can't open /proc/cpuinfo\n"); | |||
exit(1); | |||
} | |||
for (;;) { | |||
jack_time_t mhz; | |||
int ret; | |||
char buf[1000]; | |||
if (fgets(buf, sizeof(buf), f) == NULL) { | |||
jack_error("FATAL: cannot locate cpu MHz in /proc/cpuinfo\n"); | |||
exit(1); | |||
} | |||
#if defined(__powerpc__) | |||
ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz); | |||
#elif defined( __i386__ ) || defined (__hppa__) || defined (__ia64__) || \ | |||
defined(__x86_64__) | |||
ret = sscanf(buf, "cpu MHz : %" SCNu64, &mhz); | |||
#elif defined( __sparc__ ) | |||
ret = sscanf(buf, "Cpu0Bogo : %" SCNu64, &mhz); | |||
#elif defined( __mc68000__ ) | |||
ret = sscanf(buf, "Clocking: %" SCNu64, &mhz); | |||
#elif defined( __s390__ ) | |||
ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz); | |||
#else /* MIPS, ARM, alpha */ | |||
ret = sscanf(buf, "BogoMIPS : %" SCNu64, &mhz); | |||
#endif | |||
if (ret == 1) { | |||
fclose(f); | |||
return (jack_time_t)mhz; | |||
} | |||
} | |||
} | |||
SERVER_EXPORT void InitTime() | |||
{ | |||
__jack_cpu_mhz = GetMhz(); | |||
} | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) | |||
{ | |||
return get_cycles() / __jack_cpu_mhz; | |||
} | |||
#else | |||
#include <time.h> | |||
SERVER_EXPORT void InitTime() | |||
{} | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) | |||
{ | |||
struct timespec ts; | |||
clock_gettime(CLOCK_MONOTONIC, &ts); | |||
return (jack_time_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; | |||
} | |||
#endif |
@@ -1,61 +0,0 @@ | |||
/* | |||
Copyright (C) 2001-2003 Paul Davis | |||
Copyright (C) 2004-2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU Lesser General Public License as published by | |||
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef __JackTime_linux__ | |||
#define __JackTime_linux__ | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#endif | |||
#include <unistd.h> | |||
static inline void JackSleep(long usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#ifdef GETCYCLE_TIME | |||
#include "cycles.h" | |||
extern jack_time_t __jack_cpu_mhz; | |||
jack_time_t GetMhz(); | |||
void InitTime(); | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
return get_cycles() / __jack_cpu_mhz; | |||
} | |||
#else | |||
#include <time.h> | |||
void InitTime(); | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
struct timespec ts; | |||
clock_gettime(CLOCK_MONOTONIC, &ts); | |||
return (jack_time_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; | |||
} | |||
#endif | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif | |||
@@ -13,40 +13,36 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef __JackTime_APPLE__ | |||
#define __JackTime_APPLE__ | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#if defined(HAVE_CONFIG_H) | |||
#include "config.h" | |||
#endif | |||
#include "JackTime.h" | |||
#include "JackError.h" | |||
#include <mach/mach_time.h> | |||
#include <unistd.h> | |||
extern EXPORT double __jack_time_ratio; | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
return (jack_time_t) (mach_absolute_time () * __jack_time_ratio); | |||
} | |||
double __jack_time_ratio; | |||
/* This should only be called ONCE per process. */ | |||
void InitTime(); | |||
static inline void JackSleep(int usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#ifdef __cplusplus | |||
SERVER_EXPORT void JackSleep(long usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#endif | |||
/* This should only be called ONCE per process. */ | |||
SERVER_EXPORT void InitTime() | |||
{ | |||
mach_timebase_info_data_t info; | |||
mach_timebase_info(&info); | |||
__jack_time_ratio = ((float)info.numer / info.denom) / 1000; | |||
} | |||
#endif | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) | |||
{ | |||
return (jack_time_t) (mach_absolute_time () * __jack_time_ratio); | |||
} |
@@ -13,34 +13,34 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef __JackTime_WIN32__ | |||
#define __JackTime_WIN32__ | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#if defined(HAVE_CONFIG_H) | |||
#include "config.h" | |||
#endif | |||
extern SERVER_EXPORT LARGE_INTEGER _jack_freq; | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) ; | |||
#include "JackTime.h" | |||
#include "JackError.h" | |||
void InitTime(); | |||
static LARGE_INTEGER _jack_freq; | |||
static void JackSleep(int usec) | |||
{ | |||
Sleep(usec / 1000); | |||
} | |||
#ifdef __cplusplus | |||
SERVER_EXPORT JackSleep(long usec) | |||
{ | |||
Sleep(usec / 1000); | |||
} | |||
#endif | |||
SERVER_EXPORT void InitTime() | |||
{ | |||
QueryPerformanceFrequency(&_jack_freq); | |||
_jack_freq.QuadPart = _jack_freq.QuadPart / 1000000; // by usec | |||
} | |||
#endif | |||
SERVER_EXPORT jack_time_t GetMicroSeconds(void) | |||
{ | |||
LARGE_INTEGER t1; | |||
QueryPerformanceCounter(&t1); | |||
return (jack_time_t)(((double)t1.QuadPart) / ((double)_jack_freq.QuadPart)); | |||
} |
@@ -160,9 +160,6 @@ | |||
<Unit filename="..\common\JackPort.cpp" /> | |||
<Unit filename="..\common\JackPortType.cpp" /> | |||
<Unit filename="..\common\JackShmMem.cpp" /> | |||
<Unit filename="..\common\JackTime.c"> | |||
<Option compilerVar="CC" /> | |||
</Unit> | |||
<Unit filename="..\common\JackTools.cpp" /> | |||
<Unit filename="..\common\JackTransportEngine.cpp" /> | |||
<Unit filename="..\common\shm.c"> | |||
@@ -173,6 +170,9 @@ | |||
<Unit filename="JackWinProcessSync.cpp" /> | |||
<Unit filename="JackWinSemaphore.cpp" /> | |||
<Unit filename="JackWinThread.cpp" /> | |||
<Unit filename="JackWinTime.c"> | |||
<Option compilerVar="CC" /> | |||
</Unit> | |||
<Unit filename="libjack.rc"> | |||
<Option compilerVar="WINDRES" /> | |||
</Unit> | |||
@@ -140,9 +140,6 @@ | |||
<Unit filename="..\common\JackServerGlobals.cpp" /> | |||
<Unit filename="..\common\JackShmMem.cpp" /> | |||
<Unit filename="..\common\JackThreadedDriver.cpp" /> | |||
<Unit filename="..\common\JackTime.c"> | |||
<Option compilerVar="CC" /> | |||
</Unit> | |||
<Unit filename="..\common\JackTools.cpp" /> | |||
<Unit filename="..\common\JackTransportEngine.cpp" /> | |||
<Unit filename="..\common\JackWaitThreadedDriver.cpp" /> | |||
@@ -161,6 +158,9 @@ | |||
<Unit filename="JackWinProcessSync.cpp" /> | |||
<Unit filename="JackWinSemaphore.cpp" /> | |||
<Unit filename="JackWinThread.cpp" /> | |||
<Unit filename="JackWinTime.c"> | |||
<Option compilerVar="CC" /> | |||
</Unit> | |||
<Unit filename="getopt.c"> | |||
<Option compilerVar="CC" /> | |||
</Unit> | |||