This file contains hidden or 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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static SemaphoreSlim mSema1 = new SemaphoreSlim(1); | |
static SemaphoreSlim mSema2 = new SemaphoreSlim(0); |
This file contains hidden or 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
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains hidden or 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
#!/usr/bin/env python | |
# | |
# USAGE: dotnet-mapgen [-h] {generate,merge} PID | |
# | |
# In generate mode, this tool reads the /tmp/perfinfo-PID.map file generated | |
# by the CLR when running with COMPlus_PerfMapEnabled=1, and finds all load | |
# events for managed assemblies. For each managed assembly found in this way, | |
# the tool runs crossgen to generate a symbol mapping file (akin to debuginfo). | |
# | |
# In merge mode, this tool finds the load address of each managed assembly in |
This file contains hidden or 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
diff --git a/src/scripts/genXplatLttng.py b/src/scripts/genXplatLttng.py | |
index bacf034..3d40d77 100644 | |
--- a/src/scripts/genXplatLttng.py | |
+++ b/src/scripts/genXplatLttng.py | |
@@ -407,8 +407,25 @@ def generateLttngTpProvider(providerName, eventNodes, allTemplates): | |
for eventNode in eventNodes: | |
eventName = eventNode.getAttribute('symbol') | |
templateName = eventNode.getAttribute('template') | |
+ | |
+ template = allTemplates[templateName] if templateName else None |
This file contains hidden or 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
#!/usr/bin/env bash | |
# alias godev="source /usr/local/bin/godev" | |
EchoHelp() { | |
echo "Hello" | |
} | |
NewGoProject() { |
This file contains hidden or 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
# https://blogs.technet.microsoft.com/heyscriptingguy/2012/05/21/understanding-the-six-powershell-profiles/ | |
#Description | |
#Path | |
#Current User, Current Host - console | |
#$Home\[My ]Documents\WindowsPowerShell\Profile.ps1 | |
#Current User, All Hosts | |
#$Home\[My ]Documents\Profile.ps1 | |
#All Users, Current Host - console | |
#$PsHome\Microsoft.PowerShell_profile.ps1 |
This file contains hidden or 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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.0</TargetFramework> | |
<DefineConstants Condition="'$(OS)' == 'Windows_NT'">AAA;IS_WIN </DefineConstants> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Core'"> | |
<DefineConstants Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">AAA;IS_OSX</DefineConstants> | |
<DefineConstants Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">AAA;IS_LINUX</DefineConstants> |
This file contains hidden or 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
using System; | |
namespace threadpool_bench | |
{ | |
class Program | |
{ | |
static int totalRound; | |
static System.Threading.ManualResetEventSlim finishEvent; | |
static System.Threading.WaitCallback job = obj => |
This file contains hidden or 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
PWD=`pwd` | |
for file in `find $PWD`; do | |
echo $file | |
sed -i 's/XXX/YYY/g' $file | |
done |
This file contains hidden or 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
package power2 | |
// 如果一个数是2的整数次方,那么 取模 可以有优化成一条 AND 指令 | |
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 | |
// 思想是把最高有效位塞给其余的地位,第一次塞1位,第二次塞2位,第三次塞4位 第四次塞8位 第五次塞16位 | |
// 最多需要做 lg(N) 次 SHIFT + lg(N) 次 OR 既可, N是参数的位数 | |
// run on go playground https://play.golang.org/p/-3O7xKuQ-D | |
func RoundUpPowerOf2(a uint32) uint32 { | |
if a <= 1 { | |
return 2 |