For the last couple of weeks, emacs in my machine have become intermittently slow. It works fine, then suddenly (I have yet to find any triggering keystroke) it slows down for about fifteen seconds. In that period, it becomes completely unresponsive. Any character typed in that period appears after the slow-down period.
Here is the profiler report. But I don't know how to proceed further.
I am using an Ubuntu machine. I use emacs mostly to edit my LaTeX files.

M-x toggle-debug-on-quitand doC-gwhen you are in the middle of the slowdown. That should give you a backtrace. Do it again a few times to see if it is reliably reproducible. Does the backtrace look similar? Is the same function at the top of the stack? If so, post the backtrace here. Profiler reports are not particularly informative in your case: they accumulate information over a possibly long period of time (between the time that you enable and the time that you stop) so they don't accurately reflect out-of-the-ordinary events in the last few seconds.gc-cons-thresholdvalue is 800000.gc-cons-percentagevalue is 0.1