static int amlogic_get_temp(struct thermal_zone_device *thermal,
			unsigned long *temp)
{
#if 0
	if(aa>=100)
		trend=1;
	else if (aa<=40)
		trend=0;
	
	if(trend)
		aa=aa-5;
	else
		aa=aa+5;
	//get_random_bytes(&aa,4);
	printk("========  temp=%d\n",aa);
	*temp=aa;
#else
#ifdef CONFIG_AML_VIRTUAL_THERMAL
    if (trim_flag) { 
	    *temp = (unsigned long)get_cpu_temp();
    } else if (virtual_thermal_en) {
	    *temp = aml_cal_virtual_temp(); 
    } else {
        *temp = 45;                     // fix cpu temperature to 45 if not trimed && disable virtual thermal    
    }
#else
	*temp = (unsigned long)get_cpu_temp();
	pr_debug( "========  temp=%ld\n",*temp);
#endif
#endif
	return 0;
}
Beispiel #2
0
int main()
{
	float cpu_temp = 0;
	cpu_temp = get_cpu_temp();

	printf("<txt>%.1f ºC</txt>\n",cpu_temp);

	return 0;
}
Beispiel #3
0
void set_cpu_temp(int temp)
{
  while (temp != get_cpu_temp())
  {
    if (temp < get_cpu_temp())
    {
      //printf("Cooling down CPU from %dK to %dK\n", get_cpu_temp(), temp);
      // pause for 1 second to give the CPU time to cool down
      usleep(1e6);
    }
    else
    {
      //printf("Heating up CPU from %dK to %dK\n", get_cpu_temp(), temp);
      // crunch some numbers to heat up the CPU
      cpu_temp_count = 0;
      for (int i = 0; i < 1e9; ++i)
      {
        cpu_temp_count += i;
      }
    }
  }
}
/* Get temperature callback functions for thermal zone */
static int amlogic_get_temp(struct thermal_zone_device *thermal,
        unsigned long *temp)
{
    struct amlogic_thermal_platform_data *pdata = thermal->devdata;
    int tmp;

    if (pdata->trim_flag) {
        tmp = get_cpu_temp();
        if (tmp < MIN_TEMP) {
            pdata->temp_valid = 0;
            return -EINVAL;
        }
        pdata->temp_valid = 1;
        *temp = (unsigned long)get_cpu_temp();
        pdata->current_temp = *temp;
    } else if (pdata->virtual_thermal_en) {
        *temp = aml_cal_virtual_temp(pdata);
    } else {
        *temp = 45;                     // fix cpu temperature to 45 if not trimed && disable virtual thermal
    }
    return 0;
}
Beispiel #5
0
void *SysMonitorThread()
{
	int timer = 0;
	SysInfo *pSysInfo = &gSysInfo;
	DEBUG("System Monitor Thread Starts.\n");
	sleep(300);
	/* Fetch the System info */
	get_cpu_temp();
	while(1)
	{
#if 0 //to be enabled later
		if(pSysInfo->internet_available)
			cloud_send_sys_info();
#endif
		for(timer=0; timer<=SYSTEM_MONITOR_INTERVAL; timer+=60)
		{
			sleep(60);
			/* Fetch the System info */
			get_cpu_temp();
		}
	}
}
Beispiel #6
0
int main(int argc, const char *argv[])
{
        (void)argc;
        (void)argv;

        Display *dpy;
        char msg[100];

        dpy = XOpenDisplay(NULL);

        struct net_bandwidth speed;
        struct tm tm;
        time_t t;

        do
        {
                speed = get_network_speed();
                t = time(NULL);
                tm = *localtime(&t);

                sprintf(msg, "freq: %" PRIi32 "MHz "
                             "temp: %" PRIi32 "C "
                             "cpu: %" PRIi32 "%% "
                             "ram: %" PRIi64 "MB "
                             "U: %" PRIu32 "kB D: %" PRIu32 "kB "
                             "V: %" PRIi64 "%% "
                             "%02d.%02d. %02d:%02d\n",
                        get_cpu_freq(), get_cpu_temp(), get_cpu_usage(),
                        get_ram_usage(), speed.up, speed.down,
                        get_alsa_volume(), tm.tm_mday, tm.tm_mon + 1,
                        tm.tm_hour, tm.tm_min);

		XStoreName(dpy, DefaultRootWindow(dpy), msg);
		XSync(dpy, False);

        } while(!sleep(DELAY));

        XCloseDisplay(dpy);

        printf("Something happened!");

        return 0;
}