<commit_before>var BaseMetrics = require('./BaseMetrics'),
	helpers = require('../helpers');

function RafBenchmarkingRenderingStats() {
	BaseMetrics.apply(this, arguments);
}
require('util').inherits(RafBenchmarkingRenderingStats, BaseMetrics);

RafBenchmarkingRenderingStats.prototype.id = 'RafBenchmarkingRenderingStats';
RafBenchmarkingRenderingStats.prototype.probes = ['RafBenchmarkingProbe'];

RafBenchmarkingRenderingStats.prototype.getResults = function() {
	return {
		numAnimationFrames: helpers.metrics(this.__data[0].length - 1, 'rendering', this.id, 'count', 0),
		numFramesSentToScreen: helpers.metrics(this.__data[0].length - 1, 'rendering', this.id, 'count', 0),
		droppedFrameCount: helpers.metrics(this.getDroppedFrameCount_(this.__data[0]), 'rendering', this.id, 'count', 2)
	};
}

RafBenchmarkingRenderingStats.prototype.getDroppedFrameCount_ = function(frameTimes) {
	var droppedFrameCount = 0;
	var droppedFrameThreshold = 1000 / 55;
	for (var i = 1; i < frameTimes.length; i++) {
		var frameTime = frameTimes[i] - frameTimes[i - 1];
		if (frameTime > droppedFrameThreshold)
			droppedFrameCount += Math.floor(frameTime / droppedFrameThreshold);
	}
	return droppedFrameCount;
};
<commit_msg>(fix): RafRenderingStats does not have metrics when no data is available<commit_after>var BaseMetrics = require('./BaseMetrics'),
	helpers = require('../helpers');

function RafBenchmarkingRenderingStats() {
	BaseMetrics.apply(this, arguments);
}
require('util').inherits(RafBenchmarkingRenderingStats, BaseMetrics);

RafBenchmarkingRenderingStats.prototype.id = 'RafBenchmarkingRenderingStats';
RafBenchmarkingRenderingStats.prototype.probes = ['RafBenchmarkingProbe'];

RafBenchmarkingRenderingStats.prototype.getResults = function() {
	if (this.__data.length > 0) {
		return {
			numAnimationFrames: helpers.metrics(this.__data[0].length - 1, 'rendering', this.id, 'count', 0),
			numFramesSentToScreen: helpers.metrics(this.__data[0].length - 1, 'rendering', this.id, 'count', 0),
			droppedFrameCount: helpers.metrics(this.getDroppedFrameCount_(this.__data[0]), 'rendering', this.id, 'count', 2)
		};
	} else {
		return {};
	}
}

RafBenchmarkingRenderingStats.prototype.getDroppedFrameCount_ = function(frameTimes) {
	var droppedFrameCount = 0;
	var droppedFrameThreshold = 1000 / 55;
	for (var i = 1; i < frameTimes.length; i++) {
		var frameTime = frameTimes[i] - frameTimes[i - 1];
		if (frameTime > droppedFrameThreshold)
			droppedFrameCount += Math.floor(frameTime / droppedFrameThreshold);
	}
	return droppedFrameCount;
};

{'fraction_non_alphanumeric': 0.1329933307179286, 'fraction_numerical': 0.013730874852883483, 'mean_word_length': 6.327586206896552, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '4100812', 'n_tokens_mistral': 864, 'n_tokens_neox': 829, 'n_words': 149}