delta_us = timespec_to_us(&ts3) - timespec_to_us(&ts1); if (!delta_us) return -EINVAL;
temp = (timestamp2 - timestamp1) * ME_CLK_DIVIDER * 10;
temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us); /* * Enclose the division to allow the preprocessor to precalculate it, * and avoid promoting r-value to 64-bit before division.
*/
*frequency = temp * (HZ_PER_MHZ / 10);
return 0;
}
/** * adf_dev_measure_clock() - measures device clock frequency * @accel_dev: Pointer to acceleration device. * @frequency: Pointer to variable where result will be stored * @min: Minimal allowed frequency value * @max: Maximal allowed frequency value * * If the measurement result will go beyond the min/max thresholds the value * will take the value of the crossed threshold. * * This algorithm compares the device firmware timestamp with the kernel * timestamp. So we can't expect too high accuracy from this measurement. * * Return: * * 0 - measurement succeed * * -ETIMEDOUT - measurement failed
*/ int adf_dev_measure_clock(struct adf_accel_dev *accel_dev,
u32 *frequency, u32 min, u32 max)
{ int ret;
u32 freq;
ret = measure_clock(accel_dev, &freq); if (ret) return ret;
*frequency = clamp(freq, min, max);
if (*frequency != freq)
dev_warn(&GET_DEV(accel_dev), "Measured clock %d Hz is out of range, assuming %d\n",
freq, *frequency); return 0;
}
EXPORT_SYMBOL_GPL(adf_dev_measure_clock);
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.