Traditional compilation technologies are based on static analysis. Since they depend on static information, which is different from runtime information, the optimization result is not as good as expected. Profiling collects the runtime information and return to the compiler. With the information, compiler can effectively improve the performance.IXP network processor is a multi-core and multi-thread processor. It is a challenge to find out the parallelism for this kind of processor. If programmers write the program according to the hardware features, they need to deal with many complicated tasks. Therefore, multi-core and multi-thread processor needs the compiler's support. Of course, we are faced with many problems, task scheduling is one of them. Especially, inappropriate task scheduling will limit the IXP parallelism due to the stage bottleneck.In this paper, we introduce profiling technology to the network processor. We add a profiler module to the compiler. The profiler collects information through inputing some sample data. Based on the runtime information and IXP features, we build a performance evaluation model, including time model, speedup model, and priority model. Besides, an overall optimization framework and a creative task scheduling algorithm based on thread refinement are proposed. This algorithm is combined with multi-processing, multi-threading, and pasting. It heuristically allocates ME and threads for each task, and makes each stage balanced, and finally maximizes the pipeline throughput. |