Skip to content

Instantly share code, notes, and snippets.

@jacquelinekay
jacquelinekay / gist:b8c30981ddaf5d841910
Created March 28, 2015 20:55
regulations-parser: build_from.py profiled output
179940177 function calls (151169155 primitive calls) in 92.555 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 60.602 60.602 /home/jackie/code/regulations-parser/regparser/builder.py:22(__init__)
1 0.000 0.000 60.240 60.240 /home/jackie/code/regulations-parser/regparser/federalregister.py:31(fetch_notices)
21770 4.186 0.000 53.663 0.002 /usr/local/lib/python2.7/dist-packages/pyparsing.py:1010(scanString)
22981460/3177939 22.342 0.000 47.633 0.000 /usr/local/lib/python2.7/dist-packages/pyparsing.py:838(_parseNoCache)
41 0.003 0.000 47.616 1.161 /home/jackie/code/regulations-parser/regparser/notice/build.py:25(build_notice)
@jacquelinekay
jacquelinekay / regulations-parser-profile-totaltime
Created March 28, 2015 21:25
regulations-parser-profiling
179940177 function calls (151169155 primitive calls) in 79.634 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
22981460/3177939 22.104 0.000 47.204 0.000 /usr/local/lib/python2.7/dist-packages/pyparsing.py:838(_parseNoCache)
3381501/551268 9.698 0.000 19.497 0.000 /usr/local/lib/python2.7/dist-packages/constraint.py:938(__call__)
9722546/4452242 5.740 0.000 39.888 0.000 /usr/local/lib/python2.7/dist-packages/pyparsing.py:2323(parseImpl)
944536/489183 4.523 0.000 30.550 0.000 /usr/local/lib/python2.7/dist-packages/pyparsing.py:2446(parseImpl)
58010571 4.363 0.000 4.363 0.000 {method 'get' of 'dict' objects}
@jacquelinekay
jacquelinekay / gist:57dc82ae2283bba58ebf
Created June 23, 2015 20:16
Real-time safety analysis for ROS 2: raw data
>>> new
rmw_opensplice/rosidl_typesupport_opensplice_cpp/resource/msg__type_support.cpp.template: new @(spec.base_type.pkg_name)::@(subfolder)::dds_::@(spec.base_type.type)_TypeSupport();
rmw_opensplice/rosidl_typesupport_opensplice_cpp/resource/msg__type_support.cpp.template: new @(spec.base_type.pkg_name)::@(subfolder)::dds_::@(spec.base_type.type)_();
rmw_opensplice/rosidl_typesupport_opensplice_cpp/resource/srv__type_support.cpp.template: @(spec.pkg_name)::srv::dds_::Sample_@(spec.srv_name)_Request_TypeSupport * ros_request_ts = new @(spec.pkg_name)::srv::dds_::Sample_@(spec.srv_name)_Request_TypeSupport();
rmw_opensplice/rosidl_typesupport_opensplice_cpp/resource/srv__type_support.cpp.template: @(spec.pkg_name)::srv::dds_::Sample_@(spec.srv_name)_Response_TypeSupport * ros_response_ts = new @(spec.pkg_name)::srv::dds_::Sample_@(spec.srv_name)_Response_TypeSupport();
rmw_opensplice/rosidl_typesupport_opensplice_cpp/resource/srv__type_support.cpp.template: new rosidl_typesupport_opensplice_cp
@jacquelinekay
jacquelinekay / rt_static_analysis.bash
Created June 23, 2015 23:54
Bash script to produce a markdown table with real-time safety static code analysis results
#!/usr/bin/env bash
# run this in ros2_ws/src/ros2
# space-delimited list of real-time unsafe keywords
keywords="new delete malloc free std::cout std::vector std::map std::list throw"
# Get list of libraries checked
libraries=$(ls --hide examples --hide system_tests -p | grep "/")
@jacquelinekay
jacquelinekay / snippet.cpp
Created October 15, 2015 01:04
allocator template example in rclcpp
template<typename MessageT, template<typename> class Alloc = std::allocator>
class Publisher : public PublisherBase
{
// ...
Alloc<MessageT> message_allocator_;
// Publisher doesn't have any STL structures, but suppose it did (or think about the case for services):
std::vector<AnotherType, Alloc<AnotherType>> my_vector_;
// ...
void my_function() {
// instead of MessageT * msg = new MessageT;
@jacquelinekay
jacquelinekay / allocator_example.cpp
Last active April 13, 2023 18:10
allocator_traits rebind_alloc example
#include <memory>
#include <string>
// Example allocator, doesn't do anything but implements std::allocator_traits
template<typename T>
struct null_allocator {
using value_type = T;
null_allocator() {}
@jacquelinekay
jacquelinekay / apple_clang_bug.cpp
Created October 28, 2015 21:17
bug in apple clang
#include <algorithm>
#include <memory>
#include <vector>
// Example allocator, doesn't do anything but implements std::allocator_traits
template<typename T>
struct null_allocator {
using value_type = T;
using size_type = std::size_t;
using pointer = T *;
@jacquelinekay
jacquelinekay / promise_allocator.cpp
Last active November 10, 2015 20:07
promise allocator example
#include <chrono>
#include <future>
#include <iostream>
#include <memory>
#include <thread>
#include <vector>
static size_t global_allocs = 0;
static size_t global_runtime_allocs = 0;
@jacquelinekay
jacquelinekay / promise_backtrace.txt
Last active December 7, 2015 21:46
Backtrace from promise example
Starting program: /tmp/a.out
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Program received signal SIGABRT, Aborted.
0x00007ffff7531cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
@jacquelinekay
jacquelinekay / test.py
Created December 15, 2015 19:18
failing example in launch-testing with coroutine
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,