/* * Nice levels are multiplicative, with a gentle 10% change for every * nice level changed. I.e. when a CPU-bound task goes from nice 0 to * nice 1, it will get ~10% less CPU time than another CPU-bound task * that remained on nice 0. * * The "10% effect" is relative and cumulative: from _any_ nice level, * if you go up 1 level, it's -10% CPU usage, if you go down 1 level * it's +10% CPU usage. (to achieve that we use a multiplier of 1.25. * If a task goes up by ~10% and another task goes down by ~10% then * the relative distance between them is ~25%.) */ staticconstint prio_to_weight[40] = { /* -20 */88761, 71755, 56483, 46273, 36291, /* -15 */29154, 23254, 18705, 14949, 11916, /* -10 */9548, 7620, 6100, 4904, 3906, /* -5 */3121, 2501, 1991, 1586, 1277, /* 0 */1024, 820, 655, 526, 423, /* 5 */335, 272, 215, 172, 137, /* 10 */110, 87, 70, 56, 45, /* 15 */36, 29, 23, 18, 15, };
classDate; // 前置声明 classTime { friendclassDate; // 声明日期类为时间类的友元类,则在日期类中就直接访问Time类中的私有成员变量 public: Time(int hour, int minute, int second): _hour(hour), _minute(minute), _second(second) {} private: int _hour; int _minute; int _second; }; classDate { public: Date(int year = 1900, int month = 1, int day = 1): _year(year), _month(month),_day(day) {} voidSetTimeOfDate(int hour, int minute, int second) { // 直接访问时间类私有的成员变量 _t._hour = hour; _t._minute = minute; _t.second = second; } private: int _year; int _month; int _day; Time _t; };