+ cls.td_frames++;
+ cls.td_onesecondframes++;
+ // if this is the first official frame we can now grab the real
+ // td_starttime so the bogus time on the first frame doesn't
+ // count against the final report
+ if (cls.td_frames == 0)
+ {
+ cls.td_starttime = realtime;
+ cls.td_onesecondnexttime = cl.time + 1;
+ cls.td_onesecondrealtime = realtime;
+ cls.td_onesecondframes = 0;
+ cls.td_onesecondminfps = 0;
+ cls.td_onesecondmaxfps = 0;
+ cls.td_onesecondavgfps = 0;
+ cls.td_onesecondavgcount = 0;
+ }
+ if (cl.time >= cls.td_onesecondnexttime)
+ {
+ double fps = cls.td_onesecondframes / (realtime - cls.td_onesecondrealtime);
+ if (cls.td_onesecondavgcount == 0)
+ {
+ cls.td_onesecondminfps = fps;
+ cls.td_onesecondmaxfps = fps;
+ }
+ cls.td_onesecondrealtime = realtime;
+ cls.td_onesecondminfps = min(cls.td_onesecondminfps, fps);
+ cls.td_onesecondmaxfps = max(cls.td_onesecondmaxfps, fps);
+ cls.td_onesecondavgfps += fps;
+ cls.td_onesecondavgcount++;
+ cls.td_onesecondframes = 0;
+ cls.td_onesecondnexttime++;
+ }
+ }
+ else if (cl.time <= cl.mtime[0])
+ {
+ // don't need another message yet