forked from jeankalud/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vehicle Researcher
committed
Dec 24, 2017
1 parent
c7b5fb9
commit a77c0a1
Showing
73 changed files
with
10,311 additions
and
2,848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import os | ||
BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") | ||
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,47 @@ | ||
from common.realtime import sec_since_boot | ||
import time | ||
|
||
class Profiler(object): | ||
def __init__(self, enabled=False): | ||
self.enabled = enabled | ||
self.cp = [] | ||
self.start_time = sec_since_boot() | ||
self.cp = {} | ||
self.cp_ignored = [] | ||
self.iter = 0 | ||
self.start_time = time.clock() | ||
self.last_time = self.start_time | ||
|
||
def checkpoint(self, name): | ||
if not self.enabled: | ||
return | ||
tt = sec_since_boot() | ||
self.cp.append((name, tt - self.last_time)) | ||
self.last_time = tt | ||
self.tot = 0. | ||
|
||
def reset(self, enabled=False): | ||
self.enabled = enabled | ||
self.cp = [] | ||
self.start_time = sec_since_boot() | ||
self.cp = {} | ||
self.cp_ignored = [] | ||
self.iter = 0 | ||
self.start_time = time.clock() | ||
self.last_time = self.start_time | ||
|
||
def checkpoint(self, name, ignore=False): | ||
# ignore flag needed when benchmarking threads with ratekeeper | ||
if not self.enabled: | ||
return | ||
tt = time.clock() | ||
if name not in self.cp: | ||
self.cp[name] = 0. | ||
if ignore: | ||
self.cp_ignored.append(name) | ||
self.cp[name] += tt - self.last_time | ||
if not ignore: | ||
self.tot += tt - self.last_time | ||
self.last_time = tt | ||
|
||
def display(self): | ||
if not self.enabled: | ||
return | ||
self.iter += 1 | ||
print "******* Profiling *******" | ||
tot = 0.0 | ||
for n, ms in self.cp: | ||
print "%30s: %7.2f" % (n, ms*1000.0) | ||
tot += ms | ||
print " TOTAL: %7.2f" % (tot*1000.0) | ||
for n in self.cp: | ||
ms = self.cp[n] | ||
if n in self.cp_ignored: | ||
print "%30s: %7.2f perc: %1.0f" % (n, ms*1000.0, ms/self.tot*100), " IGNORED" | ||
else: | ||
print "%30s: %7.2f perc: %1.0f" % (n, ms*1000.0, ms/self.tot*100) | ||
print "Iter clock: %2.6f TOTAL: %2.2f" % (self.tot/self.iter, self.tot) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/bash | ||
|
||
function launch { | ||
# apply update | ||
if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then | ||
git reset --hard @{u} && | ||
git clean -xdf && | ||
exec "${BASH_SOURCE[0]}" | ||
fi | ||
|
||
# check if NEOS update is required | ||
while [ "$(cat /VERSION)" -lt 4 ] && [ ! -e /data/media/0/noupdate ]; do | ||
curl -o /tmp/updater https://neos.comma.ai/updater && chmod +x /tmp/updater && /tmp/updater | ||
sleep 10 | ||
done | ||
|
||
# no cpu rationing for now | ||
echo 0-3 > /dev/cpuset/background/cpus | ||
echo 0-3 > /dev/cpuset/system-background/cpus | ||
echo 0-3 > /dev/cpuset/foreground/boost/cpus | ||
echo 0-3 > /dev/cpuset/foreground/cpus | ||
echo 0-3 > /dev/cpuset/android/cpus | ||
|
||
# wait for network | ||
(cd selfdrive/ui/spinner && exec ./spinner 'waiting for network...') & spin_pid=$! | ||
until ping -W 1 -c 1 8.8.8.8; do sleep 1; done | ||
kill $spin_pid | ||
|
||
export PYTHONPATH="$PWD" | ||
|
||
# start manager | ||
cd selfdrive | ||
./manager.py | ||
|
||
# if broken, keep on screen error | ||
while true; do sleep 1; done | ||
} | ||
|
||
launch |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.