Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > 其他操作系统 > Solaris ABC for Linux/UnixDevelopers(II)
【标  题】:Solaris ABC for Linux/UnixDevelopers(II)
【关键字】:Solaris,ABC,for,Linux/UnixDevelopers,II
【来  源】:http://www.cublog.cn/u/4448/showart.php?id=275383

Solaris ABC for Linux/UnixDevelopers(II)

Your Ad Here
Guide for developers
. Sun Studio 11
> Free!
> Download
http://developers.sun.com/prodtech/cc/downloads/index.jsp
> High performance C/C++/Fortran compiler
> More optimization options than gcc
> Full IDE environment for debugging and performance
analyzing
> Available on Solaris sparc, Solaris x86 and Linux
> Default in /opt/SUNWspro/bin
> cc (c compiler), CC (C++ comiler)
> dmake (distributed make tool)
> dbx (debugger that supports multi-threading programs well)
> cc -flags (show all flags help)
> Compiler options for different target
– -xarch=v9 (64-bit application solaris sparc)
– -xarch=v8 (32-bit application solaris sparc)
– -xarch=amd64 (64-bit application solaris x64 on AMD Opteron)
> cc -xdryrun (show compiler commands and options to be used
but no compilation)
> Performance analyzer
> Profiling tool that allows you to drill down into source codes and
assembly codes and quickly find the application bottle-neck.
> Run the user process using "collect" to collect the profiling
data
– % /opt/SUNWspro/bin/collect -L unlimited -A copy -F on -d
/export/home/analyze <cmd>
> Then run analyzer GUI tool
– % cd /export/home/analyze
– % /opt/SUNWspro/bin/analyzer test.3.er
. Sun Studio 11
> Some C/C++ compiler optimizations
> -xarch=xxx (specify the cpu architecture)
> -xO4 (optimization level is 4)
> -fast (a combination of multiple optimizations, be careful for
float-pointing codes)
> -lsunperf (using Sun performance library)
> -xipo (cross-file optimization)
> -xlinkopt (optimization during linkage)
> -xautopar -xloopinfo (find and parallel loops)
> -xprefetch_level=3
> Profiling feedback based optimization
> compile with
– -xprofile=collect -xO4
> run test and generate profiling data in ./mycode.xxxx
> recompile with profileing feedback
– -xprofile=use:./mycode -xO4
> Re-run test and see performance improvements!
. Sun Gcc
> Feature compatible with gcc 4.0.2
> Debuggable with gdb and dbx
> Through advanced optimizations tuned to Sun systems
> Extra optimizations such as -xipo, -xprefetch, -xprofile
> Free!
> http://www.sun.com/download/products.xml?id=43fb4c75
> By default, installed in /opt/sfw/bin
. ATS (Automatic Tuning)
> Imagine you don't have 3rd party source codes, how do
you optimize it?
> ATS can recompile and optimize the binaries directly.
> Can also be used for
> Find the object file and the optimization flag that is causing a
runtime problem
> A simple example for ATS
> % ats -i '-xO3' a.out
> Try it !
> http://cooltools.sunsource.net/ats/index.html
> http://cooltools.sunsource.net/ats/ATS_users_guide.html
. Java
> Java runs best on Solaris!
> There're more optimization JVM settings on Solaris
> http://java.sun.com/docs/hotspot/VMOptions.html
> -XX:+UseParallelGC is often needed for multi-cpus
system
> Use latest JVM version as possible
> JVM performance is improved version by version!
. C/C++ porting to Solaris
> 4 possible target environments
> Solaris x86 32-bit
> Solaris x86 64-bit (i.e. Solaris x64)
> Solaris sparc 32-bit
> Solaris sparc 64-bit
> Which porting is easier?
> 32-bit -> 32-bit or 64-bit -> 64-bit (Easy)
> 32-bit <-> 64-bit (Difficult)
> Little Endian -> Little Endian (e.g. DEC Alpha <-> x86) or
Big Endian -> Big Endian (Easy)
> Little Endian <-> Big Endian (Difficult)
> 32-bit <-> 64-bit
> Be careful of different size for pointer type and long type
between ILP32 and LP64 data models.
> LP64
– pointer: 8 byte, long: 8 byte
> ILP32
– Pointer: 4 byte, long: 4 byte
> x86<->sparc
> Be careful of Little-endian (x86) and Big-endian (sparc)
problem on byte-operations in source codes.
> Be careful of word-alignment issue: (see next pages)
> x86<->sparc
> Be careful of word-alignment issue:
1 #include <stdio.h>
2 #include <malloc.h>
3 main(int argc, char *argv[])
4 {
5 void *p = malloc(10);
6 p++;
7 int *i;
8 i= (int *)p;
9 *i=3;
10 }
> x86<->sparc
> Using gcc to compile and run this code on both x86 and sparc
> You'll see core dump on Solaris sparc with gcc compilation
– Why? Because Line 8: i= (int *)p; the address of “i" is not aligned
(the address cannot be divided by sizeof(int))
> Try to use Sun compiler to compile and run this code on sparc
– Not core dump because the default -xmemalign=8i is used for 32-bit
application (use cc -xdryrun can show this), and the compiler inserts
interpret codes.
– If you compile with -xmemalign=8s (default for 64-bit application), the
code will core dump
> Misalignment will cause performance penalty because trap
handling is slow.

> C++ templates
> Different compilers have different supports on C++ templates
> If you use some advanced features of template, you might have porting problem.
> Platform-dependent libraries/system calls/signals
> You have to read documents for both source platform and
target platform to understand the differences and workarounds.
. Resources for developers
> http://developers.sun.com/prodtech/solaris/index.html
> Linux 到SolarisTM 10 操作系统迁移指南
> http://gceclub.sun.com.cn/download/Solaris_10/Linux_Solaris_Migration_Guide.pdf
> Sun 的studio 及编译器文档
> http://docs.sun.com/app/docs/coll/1199.3 ( 中文文档)
> http://docs.sun.com/app/docs/coll/771.7 ( 英文文档)

> Solaris 开发文档,如,多线程开发,链接库指南,64 位指南等
> http://docs.sun.com/app/docs/coll/45.20
> Sparc 处理器文档
> http://www.sun.com/processors/documentation.html
> http://developers.sun.com/solaris/articles/sparcv9.pdf
纯净如水:【上一篇】
沙漠玫瑰:【下一篇】
【相关文章】
  • OpenSolaris/Solaris中文FAQ
  • Oracle9i for SUN Solaris installation.
  • 建立交叉编译器 for arm (binutils-2.17 gcc-3.4.6 glibc-2.3.6)
  • Solaris 8 网络管理笔记
  • oracle10g for linux 安装
  • [Linux]Linux常用软件for PCer
  • 备份和恢复Windows IIS服务器设置
  • 木马群cmdbcs.exe,wsttrs.exe,msccrt.exe,winform.exe,upxdnd.exe手工杀毒方法
  • 类似SourceForge的软件协作开发平台
  • Platform builder 4.2 定制内核的一些资料(转载过来收)
  • 【随机文章】
  • 利用google在线翻译制作自己的翻译程序之ruby版
  • 编写自己的php扩展函数
  • gcc 在编译时如何去寻找所需要的头文件
  • The first step of Java[7]
  • 买好DC了!佳能A630
  • 用于postfix中用第三方插件实现邮箱大小quota的实现
  • Yahoo! 360°邀请,要的留言或者Mailto:safecn@gmail.com
  • 通用SQL数据库查询语句使用简介
  • server日志文件总结及日志满的处理办法
  • 嵌入式软件的分类、特点以及发展趋势
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.