History log of /system/chre/core/include/chre/core/event_loop.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cbf0967e920840e21bcd6aeda67d88b70d30a558 13-Mar-2018 Meng-hsuan Chung <menghsuan@google.com> Allow makefile to set the number of events allowed in the system

Bug: 74554976
Test: ./load_chre.sh and verify there's no LOGE or crash due to
insufficient number of events in event pool.

Change-Id: I86e967ed66cb5150048b09f8a9fb9aac24eee49b
/system/chre/core/include/chre/core/event_loop.h
53bc18a9e15f478ea0332a733b77c718114a8610 22-Nov-2017 Meng-hsuan Chung <menghsuan@google.com> Fix potential memory leaks

Test: compile only
Change-Id: Ida32bfcb19f7a3b738c15967d29f1b9640eadcaa
/system/chre/core/include/chre/core/event_loop.h
3c8d7a9746ec61c1677ed33f9fcd25d3830392c7 22-Nov-2017 Andrew Rossignol <aarossig@google.com> Adds a high watermark to the event pool and consolidates fatal errors

Test: ./run_sim.sh
Change-Id: If7acafe3c0b428efc2fc1c82cfabecebb82269af
/system/chre/core/include/chre/core/event_loop.h
4788193c974230e6f1813b20773bb2370d109179 01-Sep-2017 Andrew Rossignol <aarossig@google.com> Merge "Tunes the size of the event queues to 96 from 256" into oc-mr1-dev am: 04afcd8a2c
am: e8bfd12a57

Change-Id: Ib3ae189bf7593977db7ff03cd25f5cc334d60eba
88f21c7ca23d96f6ef568a06c98f3a5c4538140f 01-Sep-2017 Andrew Rossignol <aarossig@google.com> Tunes the size of the event queues to 96 from 256

- Saves memory
- Adds a high watermark log to the debug dump

Bug: 63601406
Test: ./load_chre.sh, see new field in debug dump
Change-Id: I94210ba2f62dbc1b676ff420af90c458f959b543
/system/chre/core/include/chre/core/event_loop.h
4e21bdadf6ed0242146cdd22f79e53a1979ed2ed 22-Aug-2017 Andrew Rossignol <aarossig@google.com> Switch TimerPool to use deferCallback on timer tick

- Removes usage of locks and posts a job to the main CHRE thread
- Reduces memory and code footprint
- Avoids a deeply nested timer callback that can smash the stack on
small systems

Bug: 63601374
Test: ./load_chre.sh with TimerWorld, see successful execution
Change-Id: I4489f611e5f03935e21eb77ef93d4494829e3003
/system/chre/core/include/chre/core/event_loop.h
ff1c1a2ab3ff2614bb6cea1f1d6f6e9c44a87464 05-Aug-2017 Arthur Ishiguro <arthuri@google.com> Initial framework for uimg transition for CHRE

- Creates a "power control manager" class for platform-specific power
related routines
- Creates a platform PAL base class, to be used as a central location to
perform platform specific routines related to CHRE interactions with the PAL
- For the SLPI, the following will occur:
1) We vote for big image for any event handling entry points for big image
nanoapps, and before calling a PAL API.
2) Whenever the system is idle (event loop has no pending events), we
remove our previous big image vote.
- Creates a size() function for fixed size blocking queue

Bug: 63601406
Test: Compile and run CHRE

Change-Id: I960dc883ec90d676ee638a70912e9353d470d039
/system/chre/core/include/chre/core/event_loop.h
b75315a3e185b4559d73c69eea3b30679239fac1 21-Jun-2017 Andrew Rossignol <aarossig@google.com> Inlines small functions in core/ to reduce code size

Before: 102926

After: 102510

Bug: 62838047
Test: load_chre.sh, basic sanity check
Change-Id: I7eb76057ec7be4e552d841c74d9c9354fe1e5fc5
/system/chre/core/include/chre/core/event_loop.h
d0530f420d8bdaee755ec2834af407424de195e0 16-Jun-2017 Arthur Ishiguro <arthuri@google.com> Logs CHRE state in debug dump

For starters printing the heap alloc stats, list of loaded nanoapps, and
registered sensors.

Bug: 62659408
Test: Collect bug report, verify log shows up in lshal-debug.txt
Change-Id: I614fd7c708adacab24e00483562bbd24bb13cbc6
/system/chre/core/include/chre/core/event_loop.h
0a13ba1dc673629218e13ac7f3e938a2bb9700bc 27-May-2017 Andrew Rossignol <aarossig@google.com> Reduces the event pool size in EventLoop

- This is an initial tuning and more changes will follow to further
improve this.

Test: run_sim.sh
Change-Id: I182fc9b9dec46f83c882520b3f4405c3d247b50f
/system/chre/core/include/chre/core/event_loop.h
65d679851a2c062c26f685afb450f17bce177d29 11-Apr-2017 Brian Duddie <bduddie@google.com> Implement app start/stop events

Send CHRE_EVENT_NANOAPP_STARTED and CHRE_EVENT_NANOAPP_STOPPED to inform
nanoapps of the other apps running in the system.

Test: run simulator
Change-Id: I045fd9541bb1d173a8fa90c69c370858040bb60b
/system/chre/core/include/chre/core/event_loop.h
62f187d9d736346275492e916f6001576b68bb00 07-Apr-2017 Brian Duddie <bduddie@google.com> Implement chreGetNanoappInfoBy{AppId,InstanceId}

Adds support for the CHRE API function to query information about
another nanoapp running in the system.

Test: run simulator with unload tester
Change-Id: I2eca96d8a6b2be6e231819b6957dcf626114b83d
/system/chre/core/include/chre/core/event_loop.h
2fce52a25d14fcdcba888f8ff7892dffe3f55aba 07-Apr-2017 Brian Duddie <bduddie@google.com> Minor cleanup to EventLoop and EventLoopManager

Enhance const correctness, use for-each loop for readability, and mark
one function in EventLoopManager as deprecated due to potential unsafe
use from other threads. It does not appear to be used in an unsafe
context, but the function should eventually be removed.

Test: run simulator
Change-Id: Icaea4c418ecc718ceadfb1d00332ea1dc48d69b8
/system/chre/core/include/chre/core/event_loop.h
99f01ac9bd6e351538cb8922ef15d9e838e7339a 06-Apr-2017 Brian Duddie <bduddie@google.com> Add support for unloading nanoapps

Add the capability for clients on the host to dynamically request the
unloading of a nanoapp. This initial implementation takes measures to
avoid potentially referencing the memory in the nanoapp after it is
unloaded, by flushing events and messages, but does not clean up after
the nanoapp if it leaves a sensor request open, or a timer running, or
doesn't free all of its dynamic memory, etc. As part of ensuring this
safety, CHRE will now prevent a nanoapp that is being unloaded from
sending events or messages just prior to invoking the nanoappEnd
callback.

Add an unload tester nanoapp that unloads the spammer test nanoapp after
a short delay, to help verify that event and message cleanup is handled
appropriately.

Test: run unload tester nanoapp in simulator and on SLPI, use
chre_test_client on SLPI to unload AR
Change-Id: Ib6dbe26b6414e417401412375390ceef5663d4d9
/system/chre/core/include/chre/core/event_loop.h
09a4783208b5ba1e14d0f0102eb31e688caca28d 05-Apr-2017 Brian Duddie <bduddie@google.com> Set the nanoapp context when invoking an event callback

Make EventLoop keep track of which Nanoapp is executing when invoking
the Nanoapp-supplied message free callback.

Test: compile, check MessageWorld in simulator (needs follow-up fix)
Change-Id: Ia46b8fcb21ef157b2660d7413136cbc9c377104a
/system/chre/core/include/chre/core/event_loop.h
8c56d08e149720fcb99e6ddc71289ebb5ee594e6 05-Apr-2017 Brian Duddie <bduddie@google.com> Accept events after EventLoop construction

Enables events to be posted to an EventLoop prior to calling run(),
which allows static/preloaded nanoapps to send them from their start
entry point.

Test: run simulator, verify Message World behavior
Change-Id: Ibe7b98529af769b30c618d01af2dd055def4eeb0
/system/chre/core/include/chre/core/event_loop.h
a12d05f5b1b8bd8d953a328758426b7ca8b5e6de 03-Apr-2017 Brian Duddie <bduddie@google.com> Ensure chreSendEvent invokes free callback on failure

If chreSendEvent fails to allocate an event, it must invoke the
nanoapp-supplied event free callback if non-null. However,
EventLoop::postEvent does not do this, as there are some threading
concerns that nanoapps don't need to worry about.

Test: compile only
Change-Id: Ib8f2a8511d934c4f14207a5d6ceebb1cc8ec9f69
/system/chre/core/include/chre/core/event_loop.h
5d9b2d68940f7dac47bf2fbad6f6069ed3b2faaa 27-Mar-2017 Brian Duddie <bduddie@google.com> Clean up EventLoop, fix shutdown sequence

Modify for-each Nanoapp loops to explicitly declare the type to make the
code more readable. Update the shutdown sequence to only destroy the
Nanoapp instance after flushing pending events and invoking the end
callback, and stop accepting new events once the EventLoop stop request
is received. Also, prevent loading of a nanoapp with the same app ID as
another already loaded one.

Test: run simulator
Change-Id: Ib8842773f3567486a3f848f65a5c4602698c7090
/system/chre/core/include/chre/core/event_loop.h
9d5b500a223ef73560f0dce38f50b809bde5dd0d 23-Mar-2017 Brian Duddie <bduddie@google.com> Rework Nanoapp model

Unify Nanoapp into a single monolithic object that directly exposes the
common interfaces implemented in core and platform. As a result of this,
PlatformNanoapp will no longer exist as a separate entity from Nanoapp.
In preparation for dynamic app support, refactor static nanoapp loading
to construct a UniquePtr<Nanoapp> and transfer ownership to the
EventLoop when starting a nanoapp.

This commit includes the first look at the nanoapp support library which
will be used for external nanoapps implemented as dynamic shared
objects.

Test: run chre_test_client with MessageWorld, and run the Linux simulator
Change-Id: Ic17f2c48c3156d1e5bb255b1c6a188908123d5df
/system/chre/core/include/chre/core/event_loop.h
341292509cfde0f859d89bda4ca5d55fc9772e64 22-Mar-2017 Brian Duddie <bduddie@google.com> Move instance ID generation to EventLoopManager

Instance IDs need to be global across all EventLoops, so move generation
of these IDs to the EventLoopManager singleton.

Test: run simulator
Change-Id: I29a4920667df6fdacdacab658617724b5e148d7e
/system/chre/core/include/chre/core/event_loop.h
a2f5add27054c406f36528cf8a5cbc6d4c79d246 20-Mar-2017 Brian Duddie <bduddie@google.com> Add support for querying the list of apps

Add a new FlatBuffers message to encapsulate the list of loaded apps,
and add code to CHRE to populate it. Update the reference HAL
implementation to pass the request and response through the HAL.

Test: run chre_test_client
Change-Id: I7b470daa2f051280fdb5415cdab7297de6ab4d59
/system/chre/core/include/chre/core/event_loop.h
2de17c9c5c541d72248f8371dfb4d7e402dc93e8 16-Mar-2017 Andrew Rossignol <aarossig@google.com> Updates EventLoop to construct and own Nanoapps

- It is provided with a pointer to a platform nanoapp instead.
- Nanoapps are now allocated dynamically.
- Shortens the init path for Linux/SLPI
- Prepares for more robust static nanoapp support

Test: Compile and run simulator, compile for device
Change-Id: I92503478f59745ac565403bffe8903c73f28b32e
/system/chre/core/include/chre/core/event_loop.h
30f18903edc1dfe46e12b9989760ef7a56cb31d3 02-Mar-2017 Andrew Rossignol <aarossig@google.com> Implements the chreWifiConfigureScanMonitorAsync CHRE API

Test: Compile only, WifiWorld will be extended next
Change-Id: Idb8a59ec7cbc2808fa08885ffdcd22b14b30d1b6
/system/chre/core/include/chre/core/event_loop.h
977321d9ad051d4d6519a5fa8c2ca914f4d1424f 02-Mar-2017 Brian Duddie <bduddie@google.com> Add method to map appId to instanceId, EventLoop cleanup

Change-Id: Idf0f1bbd521e5f1803222c5baf5970c18acab2dd
/system/chre/core/include/chre/core/event_loop.h
042f73e3b7f019c818f69b2c097c4b6f9db839b5 22-Feb-2017 Brian Duddie <bduddie@google.com> Add deferCallback() for use by the CHRE system

Leverage the event subsystem to implement a method of invoking a
callback from within the context of an EventLoop at some point in the
future. This can be used to transfer control from a potentially
arbitrary thread in a platform-specific callback, into a known
EventLoop context, as well as to defer processing of some event.

Also, modify EventLoop::postEvent to indicate whether the event was
successfully posted to the queue.

Change-Id: I79e5b8d5aff82fd2fb304b2a1055aebc3047b50d
/system/chre/core/include/chre/core/event_loop.h
f80ea015d077330cfdbd619680b250915ffcf1d2 09-Feb-2017 Brian Duddie <bduddie@google.com> Run CHRE in its own thread on SLPI

Update the SLPI initialization sequence to kick off a persistent thread
that runs the CHRE event loop. Add functionality to monitor for
unexpected exit of the CHRE thread, and also for unexpected exit of the
host-side process.

This change removes all test apps other than SensorWorld from the SLPI
initialization sequence.

Change-Id: Ie930e7c7adf2ba5822249fc8a76cbf7b8a1e4a7b
/system/chre/core/include/chre/core/event_loop.h
7983050d7cd84f1d5736f220ef9fd49be716b2c8 26-Jan-2017 Andrew Rossignol <aarossig@google.com> Removes the const qualifier from the getCurrentNanoapp method

- It does not help much and the non-const version is often needed to
change event subscriptions and so on.

Change-Id: I568823e769e5d68ab816c7b0dc46f1d8968a6338
/system/chre/core/include/chre/core/event_loop.h
1795db1e2282dac8454cf59d23314f70b6930f7b 18-Jan-2017 Andrew Rossignol <aarossig@google.com> Adds a SensorRequestManager

- Implements chreSensorFindDefault.
- There is still work to be done for setting the rate of the sensor.

Change-Id: Ia070cecfa0b3b157910d79ef3019773b2e8be612
/system/chre/core/include/chre/core/event_loop.h
022cc6c770c299bb364e35377a2661791475bbce 22-Dec-2016 Andrew Rossignol <aarossig@google.com> Renames BlockingQueue to FixedSizeBlockingQueue.

- Updates EventLoop to use a FixedSizeBlockingQueue.
- Updates tests.

Change-Id: I680bdbc3d2039e14b8250cb291bbb8292a304c74
/system/chre/core/include/chre/core/event_loop.h
c03d7df169f13195652de29f4452830130a0c53f 22-Dec-2016 Andrew Rossignol <aarossig@google.com> Replaces std::vector with chre::DynamicVector in EventLoop

Change-Id: I143778d079ea34dc3909e52596f4f9454006445d
/system/chre/core/include/chre/core/event_loop.h
725bef45ca127971b3ea798cd1f4e4b2c0d8fe9d 10-Dec-2016 Andrew Rossignol <aarossig@google.com> Implements portions of the SystemTimer.

- Supports requesting a timer and delivering events.
- TimerHandle generation logic.
- Multiplexes multiple requests into one underlying timer.
- Adds a TimerWorld sample app to test cyclic and one-shot timers.

Change-Id: Id992790b49618f94ab2a7ce76098394e5cc161d4
/system/chre/core/include/chre/core/event_loop.h
fbb213b072fec0a14f437ad55685c4d95eec829e 10-Dec-2016 Andrew Rossignol <aarossig@google.com> Starts building the TimerPool

- Renames Timer to TimerPool

Change-Id: Icef2fc8b791a9fb60111c44a690b3e9c51390c79
/system/chre/core/include/chre/core/event_loop.h
f7914d0fbadf2644c0c4096380c741bee2a026e0 07-Dec-2016 Andrew Rossignol <aarossig@google.com> Implements the SynchronizedMemoryPool.

The event loop is updated to use the synchronized variant.

Change-Id: I23c493d5c79f1961e251d813c53a92b3ebdbdc3a
/system/chre/core/include/chre/core/event_loop.h
a1d5686c7513f6b8a436efd9f554d8c2227a2291 07-Dec-2016 Brian Duddie <bduddie@google.com> Adds a platform abstraction for a mutex.

- Adds a SynchronizedMemoryPool shell.
- Includes SynchronizedMemoryPool in the EventLoop to verify
that compilation succeeds. The MemoryPool will eventually be replaced.

Change-Id: I932da11c303b5f757168d729f9c7a7874627cfb6
/system/chre/core/include/chre/core/event_loop.h
4927ee586656424c827920876673228fbdcf27c3 25-Nov-2016 Andrew Rossignol <aarossig@google.com> Implements the MemoryPool and integrates with the EventLoop

Unit tests are also added to the MemoryPool.

Change-Id: Icaf521c9b683d9a21a73995f6ce4a70a5ed1e9f7
/system/chre/core/include/chre/core/event_loop.h
e64f180233e64c40b56993cfea3696c5b4b16395 04-Nov-2016 Brian Duddie <bduddie@google.com> Initial import of CHRE source from external repo

Starting at commit 46a52e0 from contexthub-base.

Change-Id: I373f3a99b74757daae465b78a3d19bfce4770364
/system/chre/core/include/chre/core/event_loop.h