From mbresnah at visi.com Wed Aug 28 08:11:35 2002 From: mbresnah at visi.com (Mike Bresnahan) Date: Mon Jan 17 14:29:35 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: <000b01c22769$c38444b0$2602a8c0@Miles> Message-ID: I'm writing a Java application that needs to know what environment variable is used to locate dynamic/shared libraries on multiple OSs. I know Linux and Solaris use LD_LIBRARY_PATH, HPUX uses SHLIB_PATH, and Windows uses PATH. What does AIX use? SGI's UNIX? Others? Is LD_LIBRARY_PATH defined in POSIX? It seems like something that should be defined in a standard somewhere. *shrug* Mike From tanner at real-time.com Wed Aug 28 22:57:22 2002 From: tanner at real-time.com (Bob Tanner) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: ; from mbresnah@visi.com on Wed, Aug 28, 2002 at 08:11:35AM -0500 References: <000b01c22769$c38444b0$2602a8c0@Miles> Message-ID: <20020828225722.S3905@real-time.com> Quoting Mike Bresnahan (mbresnah@visi.com): > I'm writing a Java application that needs to know what environment variable > is used to locate dynamic/shared libraries on multiple OSs. I know Linux > and Solaris use LD_LIBRARY_PATH, HPUX uses SHLIB_PATH, and Windows uses > PATH. What does AIX use? SGI's UNIX? Others? Is LD_LIBRARY_PATH defined I've had LD_LIBRARY_PATH work under AIX, HPUX, SCO. -- Bob Tanner | Phone : (952)943-8700 http://www.mn-linux.org, Minnesota, Linux | Fax : (952)943-8500 http://www.tcwug.org, Minnesota, Wireless | Coding isn't a crime. Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 From mbresnah at visi.com Wed Aug 28 23:15:16 2002 From: mbresnah at visi.com (Mike Bresnahan) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: <20020828225722.S3905@real-time.com> Message-ID: > I've had LD_LIBRARY_PATH work under AIX, HPUX, SCO. What version of HPUX did you see LD_LIBRARY_PATH work? I used HPUX 9 through 11 (or was it 10?) and never saw LD_LIBRARY_PATH work. I used SHLIB_PATH on each of them. Mike From hopper at omnifarious.org Wed Aug 28 23:26:04 2002 From: hopper at omnifarious.org (Eric M. Hopper) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: <20020828225722.S3905@real-time.com> References: <000b01c22769$c38444b0$2602a8c0@Miles> <20020828225722.S3905@real-time.com> Message-ID: <1030595164.10545.40.camel@monster.omnifarious.org> On Wed, 2002-08-28 at 22:57, Bob Tanner wrote: > Quoting Mike Bresnahan (mbresnah@visi.com): > > I'm writing a Java application that needs to know what environment variable > > is used to locate dynamic/shared libraries on multiple OSs. I know Linux > > and Solaris use LD_LIBRARY_PATH, HPUX uses SHLIB_PATH, and Windows uses > > PATH. What does AIX use? SGI's UNIX? Others? Is LD_LIBRARY_PATH defined > > I've had LD_LIBRARY_PATH work under AIX, HPUX, SCO. LD_LIBRARY_PATH works under AIX 3.0.4. On HPUX 11+, LD_LIBRARY_PATH also works because they moved to an ELF based system from their own object file format. And, of course, under Solaris and Linux (which are both ELF based systems) LD_LIBRARY_PATH works. Some of the other more esoteric ELF variables, like LD_PRELOAD, may not be supported under HPUX 11+ or AIX. At the company I work for, we port to all three major Unixes (but not Linux yet, sadly) and Windows NT. Have fun (if at all possible), -- The best we can hope for concerning the people at large is that they be properly armed. -- Alexander Hamilton -- Eric Hopper (hopper@omnifarious.org http://www.omnifarious.org/~hopper) -- -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 228 bytes Desc: This is a digitally signed message part Url : http://shadowknight.real-time.com/pipermail/tclug-devel/attachments/20020828/a2a81426/attachment.pgp From tanner at real-time.com Wed Aug 28 23:44:41 2002 From: tanner at real-time.com (Bob Tanner) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: ; from mbresnah@visi.com on Wed, Aug 28, 2002 at 11:15:16PM -0500 References: <20020828225722.S3905@real-time.com> Message-ID: <20020828234441.U3905@real-time.com> Quoting Mike Bresnahan (mbresnah@visi.com): > > I've had LD_LIBRARY_PATH work under AIX, HPUX, SCO. > > What version of HPUX did you see LD_LIBRARY_PATH work? I used HPUX 9 > through 11 (or was it 10?) and never saw LD_LIBRARY_PATH work. I used > SHLIB_PATH on each of them. Hmm, 1994-95, so I'd say 8? -- Bob Tanner | Phone : (952)943-8700 http://www.mn-linux.org, Minnesota, Linux | Fax : (952)943-8500 http://www.tcwug.org, Minnesota, Wireless | Coding isn't a crime. Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 From mbresnah at visi.com Thu Aug 29 07:58:41 2002 From: mbresnah at visi.com (Mike Bresnahan) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] LD_LIBRARY_PATH In-Reply-To: <1030595164.10545.40.camel@monster.omnifarious.org> Message-ID: > LD_LIBRARY_PATH works under AIX 3.0.4. On HPUX 11+, LD_LIBRARY_PATH > also works because they moved to an ELF based system from their own > object file format. And, of course, under Solaris and Linux (which are > both ELF based systems) LD_LIBRARY_PATH works. Ah, so LD_LIBRARY_PATH is a ELF thing, not a POSIX thing. Thanks! Mike From mbresnah at visi.com Fri Aug 30 08:34:33 2002 From: mbresnah at visi.com (Mike Bresnahan) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: <20020828234441.U3905@real-time.com> Message-ID: Is there a high resolution timer C API on Linux? If so, what is it's name? I need a timer that will give me time with a precision better than seconds, e.g. milliseconds. I'm looking for a C function equivalent to the Java function System.currentTimeMillis() and the Win32 functions QueryPerformanceCounter() and QueryPerformanceFrequency. Mike From lamfada at lugh.net Fri Aug 30 09:31:06 2002 From: lamfada at lugh.net (Chris McKinley) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: Message-ID: On Fri, 30 Aug 2002, Mike Bresnahan wrote: > Is there a high resolution timer C API on Linux? If so, what is it's name? > I need a timer that will give me time with a precision better than seconds, > e.g. milliseconds. I'm looking for a C function equivalent to the Java > function System.currentTimeMillis() and the Win32 functions > QueryPerformanceCounter() and QueryPerformanceFrequency. gettimeofday(2) gettimeof day gets the time into a struct timeval, which is defined as: struct timeval { long tv_sec; /* seconds */ long tv_usec; /* microseconds */ }; and gives the number of seconds and usec since the epoch. -Chris McKinley From hopper at omnifarious.org Fri Aug 30 09:19:57 2002 From: hopper at omnifarious.org (Eric Mathew Hopper) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: ; from mbresnah@visi.com on Fri, Aug 30, 2002 at 08:34:33AM -0500 References: <20020828234441.U3905@real-time.com> Message-ID: <20020830091957.A29563@omnifarious.org> On Fri, Aug 30, 2002 at 08:34:33AM -0500, Mike Bresnahan wrote: > Is there a high resolution timer C API on Linux? If so, what is it's > name? I need a timer that will give me time with a precision better > than seconds, e.g. milliseconds. I'm looking for a C function > equivalent to the Java function System.currentTimeMillis() and the > Win32 functions QueryPerformanceCounter() and > QueryPerformanceFrequency. gettimeofday has a potential resolution down to microseconds. Its actual resolution may vary. Under Windows, for example, the actual resolution of System.currentTimeMillis() is 1/10th of a second. The reason I know this is that somebody tried to base a unique filename off of the time in milliseconds, and it failed more often than one might expect. I changed it to use as much of an MD5 hash of the file as it could chew through in 8 seconds, plus the time. The chance of collision there should be somewhere close to 2^-90 or so. Have fun (if at all possible), -- "It does me no injury for my neighbor to say there are twenty gods or no God. It neither picks my pocket nor breaks my leg." --- Thomas Jefferson "Go to Heaven for the climate, Hell for the company." -- Mark Twain -- Eric Hopper (hopper@omnifarious.org http://www.omnifarious.org/~hopper) -- -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://shadowknight.real-time.com/pipermail/tclug-devel/attachments/20020830/dd80ffa9/attachment.pgp From mbresnah at visi.com Fri Aug 30 19:49:41 2002 From: mbresnah at visi.com (Mike Bresnahan) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: Message-ID: Thanks, Chris. My concern with using gettimeofday() is that I don't want to pay the performance cost of doing a timezone calculation. In fact I don't require the real time. I simply want to measure the elapsed time of an operation. A simple counter running at the clock frequency of the processor would suffice; as long as I can also determine the clock frequency. I understand that the pentium processor has such a function and it requires only a small amount of assembly code to access it, however I'd prefer to not write the assembly code if I don't have to. Mike > -----Original Message----- > From: Chris McKinley [mailto:lamfada@lugh.net] > Sent: Friday, August 30, 2002 9:31 AM > To: Mike Bresnahan > Cc: tclug-devel@mn-linux.org > Subject: Re: [TCLUG-DEVEL] High Resolution Timer > > > On Fri, 30 Aug 2002, Mike Bresnahan wrote: > > > Is there a high resolution timer C API on Linux? If so, what > is it's name? > > I need a timer that will give me time with a precision better > than seconds, > > e.g. milliseconds. I'm looking for a C function equivalent to the Java > > function System.currentTimeMillis() and the Win32 functions > > QueryPerformanceCounter() and QueryPerformanceFrequency. > > gettimeofday(2) > > gettimeof day gets the time into a struct timeval, which is defined as: > > struct timeval { > long tv_sec; /* seconds */ > long tv_usec; /* microseconds */ > }; > > and gives the number of seconds and usec since the epoch. > > -Chris McKinley > > From poptix at techmonkeys.org Fri Aug 30 22:56:04 2002 From: poptix at techmonkeys.org (Matthew S. Hallacy) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: ; from mbresnah@visi.com on Fri, Aug 30, 2002 at 07:49:41PM -0500 References: Message-ID: <20020830225604.W2073@techmonkeys.org> You might want to look into using the real time clock (/dev/rtc) make sure you have support compiled into your kernel. (search google for how to use it) On Fri, Aug 30, 2002 at 07:49:41PM -0500, Mike Bresnahan wrote: > Thanks, Chris. My concern with using gettimeofday() is that I don't want to > pay the performance cost of doing a timezone calculation. In fact I don't > require the real time. I simply want to measure the elapsed time of an > operation. A simple counter running at the clock frequency of the processor > would suffice; as long as I can also determine the clock frequency. I > understand that the pentium processor has such a function and it requires > only a small amount of assembly code to access it, however I'd prefer to not > write the assembly code if I don't have to. > > Mike -- Matthew S. Hallacy FUBAR, LART, BOFH Certified http://www.poptix.net GPG public key 0x01938203 From lamfada at lugh.net Fri Aug 30 22:58:22 2002 From: lamfada at lugh.net (Chris McKinley) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: Message-ID: Interesting concern. I show that each call takes only about 1usec on a PIV 1.8GHz and about 0.4usec on a 1GHz Athlon. Here is a page which has more exact methods for doing it in assembly ... http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IA32LinuxCluster/Doc/timing.html#linuxasm Good luck. On Fri, 30 Aug 2002, Mike Bresnahan wrote: > Thanks, Chris. My concern with using gettimeofday() is that I don't want to > pay the performance cost of doing a timezone calculation. In fact I don't > require the real time. I simply want to measure the elapsed time of an > operation. A simple counter running at the clock frequency of the processor > would suffice; as long as I can also determine the clock frequency. I > understand that the pentium processor has such a function and it requires > only a small amount of assembly code to access it, however I'd prefer to not > write the assembly code if I don't have to. -Chris McKinley finger lamfada@lugh.net for GPG key From hopper at omnifarious.org Sat Aug 31 09:20:16 2002 From: hopper at omnifarious.org (Eric M. Hopper) Date: Mon Jan 17 14:29:36 2005 Subject: [TCLUG-DEVEL] High Resolution Timer In-Reply-To: References: Message-ID: <1030803616.25998.16.camel@monster.omnifarious.org> On Fri, 2002-08-30 at 19:49, Mike Bresnahan wrote: > Thanks, Chris. My concern with using gettimeofday() is that I don't want to > pay the performance cost of doing a timezone calculation. In fact I don't > require the real time. I simply want to measure the elapsed time of an > operation. A simple counter running at the clock frequency of the processor > would suffice; as long as I can also determine the clock frequency. I > understand that the pentium processor has such a function and it requires > only a small amount of assembly code to access it, however I'd prefer to not > write the assembly code if I don't have to. What timezone calculation? As near as I can tell, gettimeofday returns the time in UTC, which is what the kernel keeps its time in. If your application is so sensitive that the overhead of a system call is too much, then I don't know what to say. It sounds like the hand hacked bit of assembly is really your only choice. Even that is fraught with peril in the form of kernel timer scheduling interrupts and possibly even another process running while you're trying to do your timing. Have fun (if at all possible), -- The best we can hope for concerning the people at large is that they be properly armed. -- Alexander Hamilton -- Eric Hopper (hopper@omnifarious.org http://www.omnifarious.org/~hopper) -- -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 228 bytes Desc: This is a digitally signed message part Url : http://shadowknight.real-time.com/pipermail/tclug-devel/attachments/20020831/70aa09b2/attachment.pgp