Hi!
On 11/13/2013 08:56 PM, [email protected] wrote:
> Hi!
> -MAKE_TARGETS         := ltp_acpi LtpAcpiCmds.ko
> +MAKE_TARGETS         := ltp_acpi_cpufreq ltp_acpi LtpAcpiCmds.ko
> +
> +LDLIBS                       += -lpthread
> Ideally you should set the LDLIBS selectively for the ltp_acpi_cpufreq,
> does something like:
>
> ltp_acpi_cpufreq: LDLIBS += -lpthread
>
> work?
It works, thanks!
>>   
>> +
>> +static void setup(void)
>> +{
>> +    if (tst_kvercmp(3, 7, 0) < 0) {
>> +            tst_brkm(TCONF, NULL,
>> +                    "disable overclocking required Linux 3.7+");
>> +            return;
> The returns here are useless, the tst_brkm() calls tst_exit() which
> calls exit().
Sorry, sometimes I used to forget it.
>
>> +    }
>> +
>> +    if (access(boost, R_OK | W_OK)) {
>> +            tst_brkm(TCONF, NULL,
>> +                    "acpi-cpufreq not loaded or overclock not supported");
>> +            return;
>> +    }
> Does this test need a machine with specific ACPI implementation?
>
> I've haven't been able to find a machine to run the test on, either the
> governor is not acpi-cpufreq or the boost file is missing.
Intel CPUs must have "Turbo boost" feature and AMD "Turbo-core" feature. 
If the acpi-cpufreq driver is loaded and Linux version 3.7+, the "boost" 
file must exist in sysfs. But if a processor doesn't support the 
feature,  the file will have only read permission.

>> +    SAFE_FILE_SCANF(NULL, boost, "%d", &boost_value);
>> +
>> +    SAFE_FILE_SCANF(NULL, up_limit, "%d", &threshold);
>> +
>> +    /* change cpu0 scaling governor */
>> +    SAFE_FILE_SCANF(NULL, governor, "%s", governor_name);
>> +    SAFE_FILE_PRINTF(cleanup, governor, "%s", "userspace");
>> +
>> +    /* use only cpu0 */
>> +    cpu_set_t set;
>> +    CPU_ZERO(&set);
>> +    CPU_SET(0, &set);
>> +    if (sched_setaffinity(0, sizeof(cpu_set_t), &set) < 0)
>> +            tst_brkm(TBROK | TERRNO, cleanup, "failed to set CPU0");
>> +
>> +    SAFE_FILE_PRINTF(cleanup, up_limit, "11");
>> +}
>> +
>> +static void set_speed(int freq)
>> +{
>> +    int set_freq;
>> +    SAFE_FILE_SCANF(cleanup, setspeed, "%d", &set_freq);
>> +
>> +    if (set_freq != freq) {
>> +            tst_resm(TINFO, "change speed from %d to %d...",
>> +                    set_freq, freq);
>> +            SAFE_FILE_PRINTF(cleanup, setspeed, "%d", freq);
>> +    } else {
>> +            tst_resm(TINFO, "set speed is %d", set_freq);
>> +    }
>> +}
>> +
>> +void *thread_fn(void *val)
>> +{
>> +    struct timeval tv_start;
>> +    struct timeval tv_end;
>> +    int i, res = 0;
>> +    intptr_t timeout = (intptr_t) val;
>> +
>> +    gettimeofday(&tv_start, NULL);
>> +    tst_resm(TINFO, "load CPU0 for %ld sec...", timeout);
>> +
>> +    do {
>> +            for (i = 1; i < 1000; ++i)
>> +                    res += i * i;
>> +            gettimeofday(&tv_end, NULL);
>> +    } while ((tv_end.tv_sec - tv_start.tv_sec) < timeout);
>> +
>> +    tst_resm(TINFO, "CPU0 load done: insignificant value '%d'", res);
>> +
>> +    return NULL;
>> +}
>> +
>> +static int load_cpu(intptr_t timeout)
>> +{
>> +    pthread_t thread_id;
>> +
>> +    if (pthread_create(&thread_id, 0, thread_fn,
>> +            (intptr_t *) timeout) != 0) {
> I would cast it to (void*) here, the value is intptr_t which guarantees
> that casting it to pointer does not clobber the value and that it's
> suitably aligned, then you can cast it to (void*) so that passing it as
> parameter does not generate warning.
OK


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to