Skip to content

Instantly share code, notes, and snippets.

@pasko
pasko / cache_events.data
Last active December 11, 2015 23:18
example of events recorded from browsing one heavy website
o,s=2356760585978,e=2356760586253,key=679214551,res=-2
c,s=2356760586277,e=2356760586644,key=679214551,entry=262077501,res=0
w,s=2356760611773,e=2356760612044,entry=262077501,index=0,offset=0,buf_len=838,truncate=1,res=32569
w,s=2356760612053,e=2356760612218,entry=262077501,index=1,offset=0,buf_len=0,truncate=1,res=32569
w,s=2356760612225,e=2356760612392,entry=262077501,index=2,offset=0,buf_len=0,truncate=1,res=32569
cl,s=2356760612801,e=2356760612811,entry=262077501,res=0
o,s=2356760613750,e=2356760614082,key=727497660,res=-2
c,s=2356760614099,e=2356760614329,key=727497660,entry=262077501,res=0
w,s=2356760654480,e=2356760654671,entry=262077501,index=0,offset=0,buf_len=3578,truncate=1,res=32569
w,s=2356760654678,e=2356760654844,entry=262077501,index=1,offset=0,buf_len=0,truncate=1,res=32569
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
try {
TraceEvent.begin("CustomTabsConnection.warmupInternal");
// Warmup is done in several steps, some of them can happen only once.
// Step 1: Only once: Initialize the browser.
if (!initialized) initializeBrowser(mApplication);
#!/bin/bash
#
# Outputs to stdout a CSV with one line per function in libchrome.so.
# Should run in <10 seconds.
BINARY=gn_android/ReleaseOfficial/lib.unstripped/libchrome.so
TOOLCHAIN_PREFIX=third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi
echo 'size_in_bytes,demangled_function_name'
"$TOOLCHAIN_PREFIX-nm" --print-size --size-sort --reverse-sort "$BINARY" | \
@pasko
pasko / strace_parent.c
Created June 29, 2021 00:06
Demonstrate on-demand ptrace() of a single thread.
// Demonstrate on-demand ptrace() of a single thread, not affecting any other
// thread in the process. The Linux/x86-64 version.
//
// This differs from ptrace() examples I could find on the Web by:
// * Tracing the parent process from the child (same as Crashpad)
// * Allowing to run threads in the background
//
// This is just a *demo*. A lot of error situations are not checked for, same
// for process states (wrt to signals, for example). Uses the mix of
// fork(2)+threads and malloc() in the forked process. Uses pipe() for message
@pasko
pasko / paste
Last active September 9, 2022 09:58
This file has been truncated, but you can view the full file.
# 1 "../../base/rand_util_posix.cc"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
#define __llvm__ 1
#define __clang__ 1
#define __clang_major__ 16
#define __clang_minor__ 0
#define __clang_patchlevel__ 0
#define __clang_version__ "16.0.0 (https://chromium.googlesource.com/a/external/github.com/llvm/llvm-project fed71b04fb3cc6b1a5a21f64c26104962d816300)"
#define __GNUC__ 4
// g++ -D_GNU_SOURCE -O2 -Wall async_read_test.cc
#include <fcntl.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdint>
#include <iostream>
#include <string>