/[pcsx2_0.9.7]/trunk/pcsx2/Stats.cpp
ViewVC logotype

Annotation of /trunk/pcsx2/Stats.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 5 months ago) by william
File size: 2164 byte(s)
committing r3113 initial commit again...
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16    
17     #include "PrecompiledHeader.h"
18    
19     #include <time.h>
20    
21     #include "IopCommon.h"
22     #include "Stats.h"
23    
24     void statsOpen() {
25     stats.vsyncCount = 0;
26     stats.vsyncTime = time(NULL);
27     stats.eeCycles = 0;
28     stats.eeSCycle = 0;
29     stats.iopCycles = 0;
30     stats.iopSCycle = 0;
31     }
32    
33     void statsClose() {
34     /*
35     time_t t;
36     FILE *f;
37    
38     t = time(NULL) - stats.vsyncTime;
39     #ifdef _WIN32
40     f = fopen(LOGS_DIR "\\stats.txt", "w");
41     #else
42     f = fopen(LOGS_DIR "/stats.txt", "w");
43     #endif
44     if (!f) { Console.WriteLn("Can't open stats.txt"); return; }
45     fprintf(f, "-- PCSX2 v%s statics--\n\n", PCSX2_VERSION);
46     fprintf(f, "Ran for %d seconds\n", t);
47     fprintf(f, "Total VSyncs: %d (%s)\n", stats.vsyncCount, Config.PsxType ? "PAL" : "NTSC");
48     fprintf(f, "VSyncs per Seconds: %g\n", (double)stats.vsyncCount / t);
49     fprintf(f, "Total EE Instructions Executed: %lld\n", stats.eeCycles);
50     fprintf(f, "Total IOP Instructions Executed: %lld\n", stats.iopCycles);
51     if (!CHECK_EEREC) fprintf(f, "Interpreter Mode\n");
52     else fprintf(f, "Recompiler Mode: VUrec1 %s, VUrec0 %s\n",
53     CHECK_VU1REC ? "Enabled" : "Disabled", CHECK_VU0REC ? "Enabled" : "Disabled");
54     fclose(f);
55     */
56     }
57    
58     void statsVSync() {
59     //static u64 accum = 0, accumvu1 = 0;
60     //static u32 frame = 0;
61    
62     stats.eeCycles+= cpuRegs.cycle - stats.eeSCycle;
63     stats.eeSCycle = cpuRegs.cycle;
64     stats.iopCycles+= psxRegs.cycle - stats.iopSCycle;
65     stats.iopSCycle = psxRegs.cycle;
66     stats.vsyncCount++;
67     stats.vif1count = 0;
68     stats.vu1count = 0;
69     }

  ViewVC Help
Powered by ViewVC 1.1.22