I assume that you mean 4 threads (Solaris reports each thread as a CPU).
This gives you a number of threads - each time-sliced on a core that 
actually
executes instructions. Effectively you get 1/4th of a core (best case) 
for each
thread or 1165/4 Mhz of processing power per 'cpu'. The power of the sun4v
machine comes from cheaply switching to another runnable thread when the
current one takes a cache miss. Your test app, however, never takes a 
cache miss.
As a result the slower clock speed shows up clearly.

Jim
---


Jim Goh wrote:
> Hi,
>
> We have the following two servers both are running Solaris 10:
>
> V245 - Solaris 10, 8G memory, 8G swap, patch level 118833-24, 2 cpu operate 
> at 1504 MHz each
>
> T5120 (guest ldom) - Solaris 10, 2G memory, 1G swap, patch level 137111-05, 4 
> cpu operate at 1165 MHz each
>
> We tested with the following code and the results are very different. We even 
> tested with the whole box (T5120) with 32G memory and 64 CPUs and results are 
> same. Not sure why T5120 is slower than V245.
>
> Are they any settings that we can change in T5120 or ldoms?
>
> Thanks!
>
> // Compile using the following command
> //
> // gcc -O2 -lpthread performance.c
>
> #include <time.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <pthread.h>
> #define MS_TO_SEC 0.000001 /1/1000000/
>
> double CurrSysTime()
> {
> struct timeval tv;
> double currTime = -1;
>
> if(gettimeofday(&tv, NULL)<0)
> {
> return currTime;
> }
> currTime = tv.tv_sec tv.tv_usec*MS_TO_SEC;
> return(currTime);
> }
>
> double GetCurTime() {
> struct timeval tv;
> gettimeofday(&tv, NULL);
> return (tv.tv_sec*1000000.0 tv.tv_usec);
> }
>
> pthread_t t1 = 0;
> pthread_t t2 = 0;
> pthread_t t3 = 0;
> pthread_t t4 = 0;
> pthread_t t5 = 0;
> pthread_t t6 = 0;
> pthread_t t7 = 0;
> pthread_t t8 = 0;
> pthread_t t9 = 0;
> pthread_t t10 = 0;
>
> #define LOOP 1000000
>
> // Ten of these threads are started
> void *testThread()
> {
> int i,j;
> int num;
> double startTime;
> double endTime;
>
> startTime = GetCurTime();
> for(i =0; i < LOOP; ++i)
> {
> }
> endTime = GetCurTime();
> printf("(Thread %d)Elapsed time to loop %d times: %f (MS)\n",pthread_self(), 
> LOOP, endTime-startTime);
> }
>
> // Main Program
> main()
>
> {
> // Start up the test threads
> pthread_create(&t1, NULL, testThread, NULL);
> pthread_create(&t2, NULL, testThread, NULL);
> pthread_create(&t3, NULL, testThread, NULL);
> pthread_create(&t4, NULL, testThread, NULL);
> pthread_create(&t5, NULL, testThread, NULL);
> pthread_create(&t6, NULL, testThread, NULL);
> pthread_create(&t7, NULL, testThread, NULL);
> pthread_create(&t8, NULL, testThread, NULL);
> pthread_create(&t9, NULL, testThread, NULL);
> pthread_create(&t10, NULL, testThread, NULL);
> // Wait for the threads to finish
> sleep(10);
> }
>
> Results are:
>
> T5120
>
> (Thread 2)Elapsed time to loop 1000000 times: 6768.000000 (MS)
> (Thread 5)Elapsed time to loop 1000000 times: 6819.000000 (MS)
> (Thread 6)Elapsed time to loop 1000000 times: 6823.000000 (MS)
> (Thread 7)Elapsed time to loop 1000000 times: 6824.000000 (MS)
> (Thread 4)Elapsed time to loop 1000000 times: 6773.000000 (MS)
> (Thread 8)Elapsed time to loop 1000000 times: 6917.000000 (MS)
> (Thread 3)Elapsed time to loop 1000000 times: 6771.000000 (MS)
> (Thread 9)Elapsed time to loop 1000000 times: 6841.000000 (MS)
> (Thread 11)Elapsed time to loop 1000000 times: 6197.000000 (MS)
> (Thread 10)Elapsed time to loop 1000000 times: 6381.000000 (MS)
>
> V245
>
> (Thread 2)Elapsed time to loop 1000000 times: 1998.000000 (MS)
> (Thread 3)Elapsed time to loop 1000000 times: 1998.000000 (MS)
> (Thread 6)Elapsed time to loop 1000000 times: 2041.000000 (MS)
> (Thread 4)Elapsed time to loop 1000000 times: 2080.000000 (MS)
> (Thread 8)Elapsed time to loop 1000000 times: 1995.000000 (MS)
> (Thread 5)Elapsed time to loop 1000000 times: 1996.000000 (MS)
> (Thread 10)Elapsed time to loop 1000000 times: 2024.000000 (MS)
> (Thread 7)Elapsed time to loop 1000000 times: 1996.000000 (MS)
> (Thread 9)Elapsed time to loop 1000000 times: 1995.000000 (MS)
> (Thread 11)Elapsed time to loop 1000000 times: 1996.000000 (MS)
>   


Reply via email to