| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
# -*- coding: utf-8 -*- |
| 4 |
|
| 5 |
# #################################################################### |
| 6 |
# Copyright (C) 2005-2019 by the FIFE team |
| 7 |
# http://www.fifengine.net |
| 8 |
# This file is part of FIFE. |
| 9 |
# |
| 10 |
# FIFE is free software; you can redistribute it and/or |
| 11 |
# modify it under the terms of the GNU Lesser General Public |
| 12 |
# License as published by the Free Software Foundation; either |
| 13 |
# version 2.1 of the License, or (at your option) any later version. |
| 14 |
# |
| 15 |
# This library is distributed in the hope that it will be useful, |
| 16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 |
# Lesser General Public License for more details. |
| 19 |
# |
| 20 |
# You should have received a copy of the GNU Lesser General Public |
| 21 |
# License along with this library; if not, write to the |
| 22 |
# Free Software Foundation, Inc., |
| 23 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 |
# #################################################################### |
| 25 |
|
| 26 |
import os |
| 27 |
import sys |
| 28 |
|
| 29 |
fife_path = os.path.join('..','..','engine','python','fife') |
| 30 |
if os.path.isdir(fife_path) and fife_path not in sys.path: |
| 31 |
sys.path.insert(0,fife_path) |
| 32 |
|
| 33 |
from fife import fife |
| 34 |
print("Using the FIFE python module found here: ", os.path.dirname(fife.__file__)) |
| 35 |
|
| 36 |
from fife.extensions.fife_settings import Setting |
| 37 |
|
| 38 |
from scripts.fife_test import FifeTestApplication |
| 39 |
|
| 40 |
TDS = Setting(app_name="fife_test", settings_file="./settings.xml") |
| 41 |
|
| 42 |
def main(): |
| 43 |
app = FifeTestApplication(TDS) |
| 44 |
app.run() |
| 45 |
|
| 46 |
|
| 47 |
if __name__ == '__main__': |
| 48 |
if TDS.get("FIFE", "ProfilingOn"): |
| 49 |
import hotshot |
| 50 |
import hotshot.stats |
| 51 |
print("Starting profiler") |
| 52 |
prof = hotshot.Profile("fife.prof") |
| 53 |
prof.runcall(main) |
| 54 |
prof.close() |
| 55 |
print("analysing profiling results") |
| 56 |
stats = hotshot.stats.load("fife.prof") |
| 57 |
stats.strip_dirs() |
| 58 |
stats.sort_stats('time', 'calls') |
| 59 |
stats.print_stats(20) |
| 60 |
else: |
| 61 |
main() |