Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 126102
Collapse All | Expand All

(-)john-1.6.40-before/src/bench.c (-2 / +2 lines)
Lines 127-133 Link Here
127
	it.it_value.tv_sec = BENCHMARK_TIME;
127
	it.it_value.tv_sec = BENCHMARK_TIME;
128
	if (setitimer(ITIMER_REAL, &it, NULL)) pexit("setitimer");
128
	if (setitimer(ITIMER_REAL, &it, NULL)) pexit("setitimer");
129
#else
129
#else
130
	sig_timer_emu_init(BENCHMARK_TIME * CLK_TCK);
130
	sig_timer_emu_init(BENCHMARK_TIME * CLOCKS_PER_SEC);
131
#endif
131
#endif
132
132
133
	start_real = times(&buf);
133
	start_real = times(&buf);
Lines 174-180 Link Here
174
	int64 tmp;
174
	int64 tmp;
175
175
176
	tmp.lo = count; tmp.hi = 0;
176
	tmp.lo = count; tmp.hi = 0;
177
	mul64by32(&tmp, CLK_TCK);
177
	mul64by32(&tmp, CLOCKS_PER_SEC);
178
	cps_hi = div64by32lo(&tmp, time);
178
	cps_hi = div64by32lo(&tmp, time);
179
179
180
	if (cps_hi >= 1000000)
180
	if (cps_hi >= 1000000)
(-)john-1.6.40-before/src/idle.c (-2 / +2 lines)
Lines 68-74 Link Here
68
	current = times(&buf);
68
	current = times(&buf);
69
	if (!last_adj) last_adj = current;
69
	if (!last_adj) last_adj = current;
70
70
71
	if (current - last_adj >= CLK_TCK) {
71
	if (current - last_adj >= CLOCKS_PER_SEC) {
72
		calls_per_tick = calls_since_adj / (current - last_adj);
72
		calls_per_tick = calls_since_adj / (current - last_adj);
73
		calls_since_adj = 0;
73
		calls_since_adj = 0;
74
		last_adj = current;
74
		last_adj = current;
Lines 79-84 Link Here
79
		last_check = current;
79
		last_check = current;
80
		sched_yield();
80
		sched_yield();
81
		current = times(&buf);
81
		current = times(&buf);
82
	} while (current - last_check > 1 && current - last_adj < CLK_TCK);
82
	} while (current - last_check > 1 && current - last_adj < CLOCKS_PER_SEC);
83
#endif
83
#endif
84
}
84
}
(-)john-1.6.40-before/src/status.c (-6 / +6 lines)
Lines 58-66 Link Here
58
	if (status.crypts.hi != saved_hi) {
58
	if (status.crypts.hi != saved_hi) {
59
		ticks = get_time() - status.start_time;
59
		ticks = get_time() - status.start_time;
60
		if (ticks > ((clock_t)1 << (sizeof(clock_t) * 8 - 2))) {
60
		if (ticks > ((clock_t)1 << (sizeof(clock_t) * 8 - 2))) {
61
			time = ticks / CLK_TCK;
61
			time = ticks / CLOCKS_PER_SEC;
62
			status_restored_time += time;
62
			status_restored_time += time;
63
			status.start_time += (clock_t)time * CLK_TCK;
63
			status.start_time += (clock_t)time * CLOCKS_PER_SEC;
64
		}
64
		}
65
	}
65
	}
66
}
66
}
Lines 68-74 Link Here
68
unsigned int status_get_time(void)
68
unsigned int status_get_time(void)
69
{
69
{
70
	return status_restored_time +
70
	return status_restored_time +
71
		(get_time() - status.start_time) / CLK_TCK;
71
		(get_time() - status.start_time) / CLOCKS_PER_SEC;
72
}
72
}
73
73
74
static char *status_get_cps(char *buffer)
74
static char *status_get_cps(char *buffer)
Lines 85-95 Link Here
85
	if (use_ticks)
85
	if (use_ticks)
86
		time = ticks;
86
		time = ticks;
87
	else
87
	else
88
		time = status_restored_time + ticks / CLK_TCK;
88
		time = status_restored_time + ticks / CLOCKS_PER_SEC;
89
	if (!time) time = 1;
89
	if (!time) time = 1;
90
90
91
	cps = status.crypts;
91
	cps = status.crypts;
92
	if (use_ticks) mul64by32(&cps, CLK_TCK);
92
	if (use_ticks) mul64by32(&cps, CLOCKS_PER_SEC);
93
	div64by32(&cps, time);
93
	div64by32(&cps, time);
94
94
95
	if (cps.hi || cps.lo >= 1000000000)
95
	if (cps.hi || cps.lo >= 1000000000)
Lines 102-108 Link Here
102
		sprintf(buffer, "%u", cps.lo);
102
		sprintf(buffer, "%u", cps.lo);
103
	else {
103
	else {
104
		tmp = status.crypts;
104
		tmp = status.crypts;
105
		if (use_ticks) mul64by32(&tmp, CLK_TCK);
105
		if (use_ticks) mul64by32(&tmp, CLOCKS_PER_SEC);
106
		mul64by32(&tmp, 100);
106
		mul64by32(&tmp, 100);
107
		cps_100 = div64by32lo(&tmp, time) % 100;
107
		cps_100 = div64by32lo(&tmp, time) % 100;
108
		sprintf(buffer, "%u.%02u", cps.lo, cps_100);
108
		sprintf(buffer, "%u.%02u", cps.lo, cps_100);

Return to bug 126102