Hacker News new | past | comments | ask | show | jobs | submit | surki's comments login

Another related tool I found interesting: perf c2c

This will let us find the false sharing cost (cache contention etc).

https://joemario.github.io/blog/2016/09/01/c2c-blog/


I do something like

  find $PWD -type f -ls | awk '{gsub("/", ";", $11); print $11" "$7}' | flamegraph.pl --title "Disk usage" --countname "bytes" --nametype "file" --width 1900 --minwidth 0.05


I have been using Global for about 6 years now. Mostly I use it in emacs (though at times I use the CLI version).

I use it in Linux and Windows. I mostly work on C/C++ (Linux kernel, Windows drivers etc) and also have used it for few C# projects (via exuberant ctags backend).

One real advantage I get: I switch platforms between Linux and Windows (the place I work for has both). So I use emacs in both platforms and same gtags customization works out of box in both platforms. This relieves me in learning/using new editor/tagging system for each platform.

FWIW: my dot emacs https://github.com/surki/dotemacs/blob/master/init.org


What you describe is implemented in these libraries: libduma (http://duma.sourceforge.net/) and efence (http://linux.die.net/man/3/efence)

They also have buffer underflow protection (either overflow or underflow at a time).

But in 32 bit systems, for applications that heavily use memory, you may run out of address space


Doing it in C with mixed assembly

  [surki@linux-vrse tt]$ cat | gcc -nostdlib -x c - -o helloworld
  #define SYS_exit  1
  #define SYS_write 4
  #define stdout    1
  
  int strlen(const char *str)
  {
    long len = 0;
    while (str && *str++)
    {
        len++;
    }
  
    return len;
  }
  
  
  void print(const char *str) 
  {
      int len = strlen(str);
  
      long ret;
  
      /* Can't touch ebx directly, PIC uses it */
      __asm__ __volatile__ ("pushl %%ebx\n"
                            "movl  %%esi, %%ebx\n"
                            "int   $0x80\n;"
                            "popl  %%ebx"
                            
                            "a" (SYS_write),
                              "S" ((long) stdout),
                              "c" ((long) str),
                              "d" ((long) len));
      return;
  }
  
  void _start()
  {
    main();
  
    __asm__ __volatile__ (
         "xorl %%ebx, %%ebx\n"
         "int $0x80\n"
         
         "a" (SYS_exit));
  }
  
  int main()
  {
    print("Hello World\n");
    return 0;
  }

  [surki@linux-vrse tt]$ strip -R .comment -R .comment.SUSE.OPTs -R .note.gnu.build-id helloworld
  [surki@linux-vrse tt]$ ll helloworld 
  -rwxr-xr-x 1 suresh users 540 2010-07-21 13:19 helloworld
  
  [surki@linux-vrse tt]$ ./helloworld 
  Hello World


For moving or persisting X applications you would need something like http://en.wikipedia.org/wiki/Xmove


I use a similar setup with urxvt and stumpwm. In stumpwm I have

    ;; Launch emacs
    (defcommand emacs () ()
       (run-or-raise
        "urxvt -title emacs -e screen -U -dRR -S emacs -c ~/.screenrc.emacs"
      '(:title "emacs" :instance "urxvt" :class "URxvt")))
which will launch emacs (or raise it if it was already launched).

Some of the thing you might want to consider when doing "emacs -nw"

  - Make sure your TERM is exported appropriatly.
    Otherwise you may end up with less colors (M-x list-colors-display).
    Screen fiddles with TERM and emacs may end up supporting less colors.

  - Copy/Paste between regular X apps and the emacs will not work.
    You would need to use something like "xsel". See here [1]

  - Some of the keys may not work as expected. This will be 
    apparent especially when using orgmode. You may want to 
    remap them appropriately
And also I suggest you use Emacs + Wanderlust setup for email (and put it in a screen session as well).

[1] http://hugoheden.wordpress.com/2009/03/08/copypaste-with-ema...


Yes, these points are exactly the ones you have to pay attention to when running -nw. For instance, I run

    gnome-terminal -x /bin/bash -c /usr/bin/screen
instead of

    gnome-terminal -x /usr/bin/screen
directly, or else I get less than 256 colors (although more than 8).

Copy/Paste works fine for me in so far as that is one of the few things I use the mouse for. (I guess, in a lot of case you use the mouse anyway to select the text you'd like to copy.)

Remapping some keys is indeed necessary. In particular, GNU screen's standard escape key sequence is C-a, which in Emacs a lot of people probably prefer to be bound to (move-beginning-of-line). But also within Emacs some keys may need to be bound using input-decode-map.

As for your launcher, one thing I did differently is that my start script does not automatically re-attach to a detached screen session, but will show me a dialog window where I can select the one thing or the other. The reason for this is that I often keep a few Emacsen running in parallel for a long time, each of which is dedicated to a different aspect of my work. If I detach one session it is not always the case that I want to continue there the next time I open a new Emacs. Also, if more than one Emacs is detached I'd like to be able to say which one I want to re-attach to.

I looked at wanderlust a few years ago when I was looking for an IMAP-compatible email client for Emacs but in the end I wasn't convinced by it. Can't remember, though, what I didn't like about it, perhaps I should give it another chance.


Probably you are using x selection buffer for copy/paste. But if you want to pick up stuff from X "clipboard" buffer, you would need xsel or something like that.

Wanderlust is quite usable now. I use it everyday(I have my gmail and exchange server(imap) accounts managed in it). You should give it another try sometime.


I think "The Man from Earth" was also partially distributed through torrents. At least that's what the wikipedia claims - http://en.wikipedia.org/wiki/The_Man_from_Earth


I use something like this to watch the processes that are running or waiting for IO

  watch -n 1 ps -eo pid,ppid,wchan=WIDE-WCHAN-COLUMN,stat,command r


Nice. However, it doesn't account for activity during the gap between samples, while sorting by CPU usage in top or by I/O usage in iotop does.


You probably want to use tsocks. It LD_PRELOADs the socket related functions and does the necessary work.

http://tsocks.sourceforge.net/faq.php


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: