diff --git a/ChangeLog b/ChangeLog index 4db84e39..8c6b7ec4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,28 +17,33 @@ Nedko Arnaudov Fernando Lopez-Lezcano Romain Moret Florian Faber +Michael Voigt --------------------------- Jackdmp changes log --------------------------- -2008-08-17 Stephane Letz +2008-08-19 Stephane Letz + + * Michael Voigt JackTime patch. + +2008-09-17 Stephane Letz * New JackDriverInfo class to cleanup driver loading code. -2008-08-08 Stephane Letz +2008-09-08 Stephane Letz * Better symbols export for server and client side libraries. -2008-08-06 Stephane Letz +2008-09-06 Stephane Letz * Correct driver hierarchy on macosx and windows targets. -2008-08-05 Stephane Letz +2008-09-05 Stephane Letz * Merge Michael Voigt "drops" branch after reorganization step. -2008-08-04 Stephane Letz +2008-09-04 Stephane Letz * Michael Voigt 4th source reorganization patch. * Correct JackNetDriver initialization. diff --git a/common/JackDriver.cpp b/common/JackDriver.cpp index d9b47c7c..26c218e8 100644 --- a/common/JackDriver.cpp +++ b/common/JackDriver.cpp @@ -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" diff --git a/common/JackDriverLoader.cpp b/common/JackDriverLoader.cpp index de6116e5..ef7bb565 100644 --- a/common/JackDriverLoader.cpp +++ b/common/JackDriverLoader.cpp @@ -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 { diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index bd878a20..f358b35f 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include #include "JackSystemDeps.h" - #include "JackLockedEngine.h" #include "JackExternalClient.h" #include "JackInternalClient.h" diff --git a/common/JackServerAPI.cpp b/common/JackServerAPI.cpp index 8aaee585..7021f0fe 100644 --- a/common/JackServerAPI.cpp +++ b/common/JackServerAPI.cpp @@ -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" diff --git a/common/JackTime.c b/common/JackTime.c deleted file mode 100644 index 6def7b90..00000000 --- a/common/JackTime.c +++ /dev/null @@ -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 -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 diff --git a/common/JackTime.h b/common/JackTime.h index 3afbadfe..77cc1894 100644 --- a/common/JackTime.h +++ b/common/JackTime.h @@ -23,11 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "types.h" #include "JackCompilerDeps.h" -#include - -#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 diff --git a/common/JackTools.h b/common/JackTools.h index b0f22853..34141cc3 100644 --- a/common/JackTools.h +++ b/common/JackTools.h @@ -32,16 +32,16 @@ #include #endif +#include "jslist.h" +#include "driver_interface.h" +#include "JackCompilerDeps.h" +#include "JackError.h" + #include #include #include #include #include -#include "jslist.h" -#include "driver_interface.h" - -#include "JackCompilerDeps.h" -#include "JackError.h" namespace Jack { diff --git a/common/wscript b/common/wscript index 4176fde7..8b681c68 100644 --- a/common/wscript +++ b/common/wscript @@ -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 diff --git a/linux/JackLinuxTime.c b/linux/JackLinuxTime.c new file mode 100644 index 00000000..b6499d05 --- /dev/null +++ b/linux/JackLinuxTime.c @@ -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 + +SERVER_EXPORT void JackSleep(long usec) +{ + usleep(usec); +} + +#ifdef GETCYCLE_TIME + + #include + #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 + 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 diff --git a/linux/JackTime_os.h b/linux/JackTime_os.h deleted file mode 100644 index 12505e9a..00000000 --- a/linux/JackTime_os.h +++ /dev/null @@ -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 - - 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 - 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 - diff --git a/macosx/JackTime_os.h b/macosx/JackMachTime.c similarity index 57% rename from macosx/JackTime_os.h rename to macosx/JackMachTime.c index 2d705828..7c4d38ad 100644 --- a/macosx/JackTime_os.h +++ b/macosx/JackMachTime.c @@ -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 #include - 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); +} diff --git a/windows/JackTime_os.h b/windows/JackWinTime.c similarity index 56% rename from windows/JackTime_os.h rename to windows/JackWinTime.c index fdf44231..65a09170 100644 --- a/windows/JackTime_os.h +++ b/windows/JackWinTime.c @@ -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)); +} diff --git a/windows/libjack.cbp b/windows/libjack.cbp index df7f2bcc..c0b54295 100644 --- a/windows/libjack.cbp +++ b/windows/libjack.cbp @@ -160,9 +160,6 @@ - - @@ -173,6 +170,9 @@ + + diff --git a/windows/libjackserver.cbp b/windows/libjackserver.cbp index eccded65..475e9984 100644 --- a/windows/libjackserver.cbp +++ b/windows/libjackserver.cbp @@ -140,9 +140,6 @@ - - @@ -161,6 +158,9 @@ + +