Skip to content

Instantly share code, notes, and snippets.

View omo's full-sized avatar

Hajime Morrita omo

  • Mountain View, CA
View GitHub Profile
@omo
omo / perf_small_hack.svg
Created February 14, 2015 01:14
Benchmark results
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omo
omo / counts.py
Created February 3, 2015 02:37
counts.py w/ Pandas
import pandas as pd
import json
import sys
import datetime as dt
data = json.load(open(sys.argv[1]))
df = pd.DataFrame(data["entries"])
df['date'] = pd.to_datetime(df['date'])
import json
import sys
import pandas as pd
import matplotlib.pyplot as plt
from optparse import OptionParser
def make_dataframe(raw_events, name):
#start_ts = {}
filtered = [ dict(e.items() + e["args"].items()) for e in raw_events if e["name"] == name ]
@omo
omo / trace.py
Created December 17, 2014 18:08
#!/usr/bin/env python
import json
import sys
import pandas as pd
import matplotlib.pyplot as plt
def delay_of(sync, chrd):
ret = []
si = 0
@omo
omo / bar_plot.R
Last active August 29, 2015 14:04
qplot(x=year, y=injuries, data=t_per_year, geom="bar", stat="identity")
@omo
omo / gist:b2b0a5d4d680bf5ad39f
Created July 5, 2014 00:07
status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent)
status_t InputConsumer::consume(InputEventFactoryInterface* factory,
bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) {
...
*outSeq = 0;
*outEvent = NULL;
// Fetch the next input message.
// Loop until an event can be returned or no additional events are received.
while (!*outEvent) {
if (mMsgDeferred) {
...
@omo
omo / gist:2790ecf8a9434f5f41c4
Created July 4, 2014 23:57
int NativeInputEventReceiver::handleEvent(int receiveFd, int events, void* data)
int NativeInputEventReceiver::handleEvent(int receiveFd, int events, void* data) {
....
if (events & ALOOPER_EVENT_INPUT) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
status_t status = consumeEvents(env, false /*consumeBatches*/, -1, NULL);
mMessageQueue->raiseAndClearException(env, "handleReceiveCallback");
return status == OK || status == NO_MEMORY ? 1 : 0;
}
@omo
omo / gist:30c01500ddb5e27fcba8
Created July 4, 2014 23:57
status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime, bool* outConsumedBatch)
status_t NativeInputEventReceiver::consumeEvents(JNIEnv* env,
bool consumeBatches, nsecs_t frameTime, bool* outConsumedBatch) {
....
ScopedLocalRef<jobject> receiverObj(env, NULL);
bool skipCallbacks = false;
for (;;) {
uint32_t seq;
InputEvent* inputEvent;
status_t status = mInputConsumer.consume(&mInputEventFactory,
@omo
omo / gist:11274718
Created April 25, 2014 01:03
List of IPC Messages
IPC_MESSAGE_ROUTED4(ExtensionMsg_Response, int , bool , base::ListValue , std::string )
IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke, std::string , std::string , std::string , base::ListValue , bool )
IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames, std::vector<std::string>)
IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont, std::string , std::string )
IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension, std::string )
IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded, std::vector<ExtensionMsg_Loaded_Params>)
IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded, std::string)
IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist, extensions::ExtensionsClient::ScriptingWhitelist)
IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode, ExtensionMsg_ExecuteCode_Params)
IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdateUserScripts, base::SharedMemoryHandle)