<commit_before>/*
 * DVFS.h
 *
 *  Created on: 15 Feb, 2015
 *      Author: yeokm1
 */

#ifndef DVFS_DVFS_H_
#define DVFS_DVFS_H_

#include "cpu/CPUOdroid.h"
#include "cpu/CPUNexus5.h"
#include "gpu/GPUOdroid.h"
#include "gpu/GPUNexus5.h"


#include <vector>
#include <string>

//#define DEBUG

#ifdef DEBUG
#  define D(x) x
#else
#  define D(x)
#endif

#define CLASSNAME "DVFS-ndk"
#define POLL_RATE_IN_MICROSECOND 1000000  //1 second
#define DO_NOT_PURSUE_FPS_VALUE -1
#define SLIDING_WINDOW_LENGTH 5
#define GO_BACK_TO_ONDEMAND_IF_FPS_NOT_DETECTED 3
#define DYNAMIC_FPS_TARGET -1

using std::vector;
using std::string;

class DVFS {
public:
	DVFS(int fpsLowBound, int fpsHighBound);
	void startDVFS();
	void stopDVFS();
	virtual ~DVFS();

private:
	int timeval_subtract(struct timeval *result, struct timeval *t2, struct timeval *t1);
	bool isPhoneOdroid();
	string getModel();
	bool loopInProgress;
	int numTimesFPSNotDetected;
	bool dynamicTargetRange;
	void decideDynamicFPSTarget();
	int getBatteryLevel();
	double mapRange(double a1,double a2,double b1,double b2,double s);

protected:

	void fpsDetected();
	void noFpsDetected();
	bool inGameMode;
	CPU * cpu;
	GPU * gpu;
	int fpsLowBound;
	int fpsHighBound;
	int currentSlidingWindowPosition;
	virtual void regularRunner();
	int findLowestFreqPositionThatMeetsThisCost(double costToMeet, vector<long> availableFrequencies, float factor);
	int shouldPursueFPSRecalculationToThisFPS(int fps);
	void readySystemForDVFS();
	void setSystembackToDefault();
};

#endif /* DVFS_DVFS_H_ */
<commit_msg>increase threshold to go back to ondemand to 5<commit_after>/*
 * DVFS.h
 *
 *  Created on: 15 Feb, 2015
 *      Author: yeokm1
 */

#ifndef DVFS_DVFS_H_
#define DVFS_DVFS_H_

#include "cpu/CPUOdroid.h"
#include "cpu/CPUNexus5.h"
#include "gpu/GPUOdroid.h"
#include "gpu/GPUNexus5.h"


#include <vector>
#include <string>

//#define DEBUG

#ifdef DEBUG
#  define D(x) x
#else
#  define D(x)
#endif

#define CLASSNAME "DVFS-ndk"
#define POLL_RATE_IN_MICROSECOND 1000000  //1 second
#define DO_NOT_PURSUE_FPS_VALUE -1
#define SLIDING_WINDOW_LENGTH 5
#define GO_BACK_TO_ONDEMAND_IF_FPS_NOT_DETECTED 5
#define DYNAMIC_FPS_TARGET -1

using std::vector;
using std::string;

class DVFS {
public:
	DVFS(int fpsLowBound, int fpsHighBound);
	void startDVFS();
	void stopDVFS();
	virtual ~DVFS();

private:
	int timeval_subtract(struct timeval *result, struct timeval *t2, struct timeval *t1);
	bool isPhoneOdroid();
	string getModel();
	bool loopInProgress;
	int numTimesFPSNotDetected;
	bool dynamicTargetRange;
	void decideDynamicFPSTarget();
	int getBatteryLevel();
	double mapRange(double a1,double a2,double b1,double b2,double s);

protected:

	void fpsDetected();
	void noFpsDetected();
	bool inGameMode;
	CPU * cpu;
	GPU * gpu;
	int fpsLowBound;
	int fpsHighBound;
	int currentSlidingWindowPosition;
	virtual void regularRunner();
	int findLowestFreqPositionThatMeetsThisCost(double costToMeet, vector<long> availableFrequencies, float factor);
	int shouldPursueFPSRecalculationToThisFPS(int fps);
	void readySystemForDVFS();
	void setSystembackToDefault();
};

#endif /* DVFS_DVFS_H_ */

{'fraction_non_alphanumeric': 0.10321758521822236, 'fraction_numerical': 0.01752150366358713, 'mean_word_length': 5.781857451403888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3597683', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1206, 'n_words': 290}