> Your patches could make a lot of sense when integrated with my
> patches:
>
> http://people.redhat.com/riel/cstate/
> However, we should probably get the tracepoint upstream first,
> so we can know for sure :)

I can not access the patches at this directory. Can you send it to me?
I will look at your patches and then integrated with my patches to look
what will happen tomorrow.

Do you have test case share? or ideas how to show the benefit.

I have done many test for my pathes. It show some benefit big or small
in various cases, but there is no negative effect showed at least. 
 
I have two onviced test cases to show the great benefit
1.  turbostat v1 (before 3.5)
2. I write the simple test application which also show greate benefit.
running it by #./idle_predict -l 8


I write a simple application using usleep which it is clear to the
repeat mode prediction failure will greatly effect the application with
such repeat pattern.

-----------------------
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include <pthread.h>

volatile int * shutdown;
volatile long * count;
int delay = 20;
int loop = 8;

void usage(void)
{
        fprintf(stderr,
                "Usage: idle_predict [options]\n"
                "  --help       -h  Print this help\n"
                "  --thread     -n  Thread number\n"
                "  --loop       -l  Loop times in shallow Cstate\n"
                "  --delay      -t  Sleep time (uS)in shallow
Cstate\n");
}

void *simple_loop() {
        int idle_num = 1;
        while (*shutdown) {
                *count = *count + 1;
        
                if (idle_num % loop)
                        usleep(delay);
                else {
                        /* sleep 1 second */
                        usleep(1000000);
                        idle_num = 0;
                }
                idle_num++;
        }

}

static void sighand(int sig)
{
        *shutdown = 0;
}

int main(int argc, char *argv[])
{
        sigset_t sigset;
        int signum = SIGALRM;
        int i, c, er = 0, thread_num = 8;
        pthread_t pt[1024];

        static char optstr[] = "n:l:t:h:";

        while ((c = getopt(argc, argv, optstr)) != EOF)
                switch (c) {
                        case 'n':
                                thread_num = atoi(optarg);
                                break;
                        case 'l':
                                loop = atoi(optarg);
                                break;
                        case 't':
                                delay = atoi(optarg);
                                break;
                        case 'h':
                        default:
                                usage();
                                exit(1);
                }

        printf("thread=%d,loop=%d,delay=%d\n",thread_num,loop,delay);
        count = malloc(sizeof(long));
        shutdown = malloc(sizeof(int));
        *count = 0;
        *shutdown = 1;

        sigemptyset(&sigset);
        sigaddset(&sigset, signum);
        sigprocmask (SIG_BLOCK, &sigset, NULL);
        signal(SIGINT, sighand);
        signal(SIGTERM, sighand);

        for(i = 0; i < thread_num ; i++)
                pthread_create(&pt[i], NULL, simple_loop, NULL);

        for (i = 0; i < thread_num; i++)
                pthread_join(pt[i], NULL);

        exit(0);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to